lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <49260a2e-a510-4d44-8644-38863abb16c1@web.de>
Date: Wed, 2 Oct 2024 19:52:18 +0200
From: Markus Elfring <Markus.Elfring@....de>
To: linux-arm-kernel@...ts.infradead.org, Andrew Lunn <andrew@...n.ch>,
 Gregory Clement <gregory.clement@...tlin.com>,
 Russell King <linux@...linux.org.uk>,
 Sebastian Hesselbarth <sebastian.hesselbarth@...il.com>,
 Thomas Petazzoni <thomas.petazzoni@...e-electrons.com>
Cc: LKML <linux-kernel@...r.kernel.org>, kernel-janitors@...r.kernel.org,
 Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
Subject: [PATCH 2/2] ARM: mvebu: Use common of_node_put() code in
 mvebu_pm_suspend_init()

From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Wed, 2 Oct 2024 19:15:09 +0200

Add a local variable “rc” and a label so that a bit of exception handling
can be better reused at the end of this function implementation.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
 arch/arm/mach-mvebu/pm.c | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/arch/arm/mach-mvebu/pm.c b/arch/arm/mach-mvebu/pm.c
index b149d9b77505..cd85f2c56836 100644
--- a/arch/arm/mach-mvebu/pm.c
+++ b/arch/arm/mach-mvebu/pm.c
@@ -235,6 +235,7 @@ int __init mvebu_pm_suspend_init(void (*board_pm_enter)(void __iomem *sdram_reg,
 {
 	struct device_node *np;
 	struct resource res;
+	int rc;

 	np = of_find_compatible_node(NULL, NULL,
 				     "marvell,armada-xp-sdram-controller");
@@ -242,26 +243,26 @@ int __init mvebu_pm_suspend_init(void (*board_pm_enter)(void __iomem *sdram_reg,
 		return -ENODEV;

 	if (of_address_to_resource(np, 0, &res)) {
-		of_node_put(np);
-		return -ENODEV;
+		rc = -ENODEV;
+		goto put_node;
 	}

 	if (!request_mem_region(res.start, resource_size(&res),
 				np->full_name)) {
-		of_node_put(np);
-		return -EBUSY;
+		rc = -EBUSY;
+		goto put_node;
 	}

 	sdram_ctrl = ioremap(res.start, resource_size(&res));
 	if (!sdram_ctrl) {
 		release_mem_region(res.start, resource_size(&res));
-		of_node_put(np);
-		return -ENOMEM;
+		rc = -ENOMEM;
+		goto put_node;
 	}

-	of_node_put(np);
-
 	mvebu_board_pm_enter = board_pm_enter;
-
-	return 0;
+	rc = 0;
+put_node:
+	of_node_put(np);
+	return rc;
 }
--
2.46.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ