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: <8a7607f8-d634-415e-8269-e26dcc0f9fdc@web.de>
Date: Sat, 2 Mar 2024 12:42:08 +0100
From: Markus Elfring <Markus.Elfring@....de>
To: linux-input@...r.kernel.org, kernel-janitors@...r.kernel.org,
 Dmitry Torokhov <dmitry.torokhov@...il.com>, Jeff LaBundy
 <jeff@...undy.com>, Rob Herring <robh@...nel.org>,
 Uwe Kleine-König <u.kleine-koenig@...gutronix.de>
Cc: LKML <linux-kernel@...r.kernel.org>
Subject: [PATCH] Input: iqs626a - Use common error handling code in
 iqs626_parse_events()

From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Sat, 2 Mar 2024 11:44:17 +0100

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

This issue was transformed by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
 drivers/input/misc/iqs626a.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/input/misc/iqs626a.c b/drivers/input/misc/iqs626a.c
index 0dab54d3a060..fa9570755f7b 100644
--- a/drivers/input/misc/iqs626a.c
+++ b/drivers/input/misc/iqs626a.c
@@ -530,8 +530,7 @@ iqs626_parse_events(struct iqs626_private *iqs626,
 					dev_err(&client->dev,
 						"Invalid input type: %u\n",
 						val);
-					fwnode_handle_put(ev_node);
-					return -EINVAL;
+					goto put_fwnode;
 				}

 				iqs626->kp_type[ch_id][i] = val;
@@ -545,8 +544,7 @@ iqs626_parse_events(struct iqs626_private *iqs626,
 				dev_err(&client->dev,
 					"Invalid %s channel hysteresis: %u\n",
 					fwnode_get_name(ch_node), val);
-				fwnode_handle_put(ev_node);
-				return -EINVAL;
+				goto put_fwnode;
 			}

 			if (i == IQS626_EVENT_DEEP_DN ||
@@ -566,8 +564,7 @@ iqs626_parse_events(struct iqs626_private *iqs626,
 				dev_err(&client->dev,
 					"Invalid %s channel threshold: %u\n",
 					fwnode_get_name(ch_node), val);
-				fwnode_handle_put(ev_node);
-				return -EINVAL;
+				goto put_fwnode;
 			}

 			if (ch_id == IQS626_CH_HALL)
@@ -580,6 +577,10 @@ iqs626_parse_events(struct iqs626_private *iqs626,
 	}

 	return 0;
+
+put_fwnode:
+	fwnode_handle_put(ev_node);
+	return -EINVAL;
 }

 static noinline_for_stack int
--
2.44.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ