Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1707644

[PATCH v2 3/4] ACPI-APEI-HEST: Move an assignment in hest_ghes_dev_register()

From SF Markus Elfring <elfring@users.sourceforge.net>
Newsgroups linux.kernel
Subject [PATCH v2 3/4] ACPI-APEI-HEST: Move an assignment in hest_ghes_dev_register()
Date 2017-08-09 20:10 +0200
Message-ID <ucDAC-2mx-17@gated-at.bofh.it> (permalink)
References (1 earlier) <se8x4-8O-19@gated-at.bofh.it> <se9W9-12j-1@gated-at.bofh.it> <sefoR-4Nx-1@gated-at.bofh.it> <semJH-1kY-3@gated-at.bofh.it> <ucDAB-2mx-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 5 Sep 2016 21:15:22 +0200

Move one assignment for a data structure member in one local variable
so that its setting will only be performed after a corresponding memory
allocation succeeded by this function.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/acpi/apei/hest.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/acpi/apei/hest.c b/drivers/acpi/apei/hest.c
index 24d1d3cd3371..94b9bd494c20 100644
--- a/drivers/acpi/apei/hest.c
+++ b/drivers/acpi/apei/hest.c
@@ -194,13 +194,13 @@ static int __init hest_ghes_dev_register(unsigned int ghes_count)
 	int rc, i;
 	struct ghes_arr ghes_arr;
 
-	ghes_arr.count = 0;
 	ghes_arr.ghes_devs = kmalloc_array(ghes_count,
 					   sizeof(*ghes_arr.ghes_devs),
 					   GFP_KERNEL);
 	if (!ghes_arr.ghes_devs)
 		return -ENOMEM;
 
+	ghes_arr.count = 0;
 	rc = apei_hest_parse(hest_parse_ghes, &ghes_arr);
 	if (rc)
 		goto err;
-- 
2.13.4

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH v2 3/4] ACPI-APEI-HEST: Move an assignment in  hest_ghes_dev_register() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-08-09 20:10 +0200

csiph-web