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-next>] [day] [month] [year] [list]
Message-ID: <5faec5de-fc36-4b38-abcb-c61954a824cd@web.de>
Date: Wed, 5 Jun 2024 16:30:30 +0200
From: Markus Elfring <Markus.Elfring@....de>
To: linux-leds@...r.kernel.org, Abdel Alkuor <alkuor@...il.com>,
 Lee Jones <lee@...nel.org>, Pavel Machek <pavel@....cz>
Cc: LKML <linux-kernel@...r.kernel.org>
Subject: [PATCH] leds: ncp5623: Use common error handling code in
 ncp5623_probe()

From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Wed, 5 Jun 2024 16:19:26 +0200

Add a label so that a bit of exception handling can be better reused
at the end of this function implementation.

Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
 drivers/leds/rgb/leds-ncp5623.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/leds/rgb/leds-ncp5623.c b/drivers/leds/rgb/leds-ncp5623.c
index 2be4ff918516..f18156683375 100644
--- a/drivers/leds/rgb/leds-ncp5623.c
+++ b/drivers/leds/rgb/leds-ncp5623.c
@@ -183,16 +183,12 @@ static int ncp5623_probe(struct i2c_client *client)

 	fwnode_for_each_available_child_node(mc_node, led_node) {
 		ret = fwnode_property_read_u32(led_node, "color", &color_index);
-		if (ret) {
-			fwnode_handle_put(led_node);
-			goto release_mc_node;
-		}
+		if (ret)
+			goto release_led_node;

 		ret = fwnode_property_read_u32(led_node, "reg", &reg);
-		if (ret) {
-			fwnode_handle_put(led_node);
-			goto release_mc_node;
-		}
+		if (ret)
+			goto release_led_node;

 		subled_info[ncp->mc_dev.num_colors].channel = reg;
 		subled_info[ncp->mc_dev.num_colors++].color_index = color_index;
@@ -223,6 +219,10 @@ static int ncp5623_probe(struct i2c_client *client)
 	fwnode_handle_put(mc_node);

 	return ret;
+
+release_led_node:
+	fwnode_handle_put(led_node);
+	goto release_mc_node;
 }

 static void ncp5623_remove(struct i2c_client *client)
--
2.45.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ