public inbox for linux-input@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Input: iqs269a - Use common error handling code in iqs269_parse_chan()
@ 2024-03-02  8:24 Markus Elfring
  2024-03-03 22:31 ` Dmitry Torokhov
  0 siblings, 1 reply; 7+ messages in thread
From: Markus Elfring @ 2024-03-02  8:24 UTC (permalink / raw)
  To: linux-input, kernel-janitors, Dmitry Torokhov, Jeff LaBundy,
	Mattijs Korpershoek, Uwe Kleine-König, ye xingchen
  Cc: LKML

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 2 Mar 2024 09:15:20 +0100

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

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/input/misc/iqs269a.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/input/misc/iqs269a.c b/drivers/input/misc/iqs269a.c
index cd14ff9f57cf..1379f80c00e2 100644
--- a/drivers/input/misc/iqs269a.c
+++ b/drivers/input/misc/iqs269a.c
@@ -744,8 +744,7 @@ static int iqs269_parse_chan(struct iqs269_private *iqs269,
 				dev_err(&client->dev,
 					"Invalid channel %u threshold: %u\n",
 					reg, val);
-				fwnode_handle_put(ev_node);
-				return -EINVAL;
+				goto put_fwnode;
 			}

 			ch_reg->thresh[iqs269_events[i].th_offs] = val;
@@ -758,8 +757,7 @@ static int iqs269_parse_chan(struct iqs269_private *iqs269,
 				dev_err(&client->dev,
 					"Invalid channel %u hysteresis: %u\n",
 					reg, val);
-				fwnode_handle_put(ev_node);
-				return -EINVAL;
+				goto put_fwnode;
 			}

 			if (i == IQS269_EVENT_DEEP_DN ||
@@ -805,6 +803,10 @@ static int iqs269_parse_chan(struct iqs269_private *iqs269,
 	}

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

 static int iqs269_parse_prop(struct iqs269_private *iqs269)
--
2.44.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-03-04 18:59 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-02  8:24 [PATCH] Input: iqs269a - Use common error handling code in iqs269_parse_chan() Markus Elfring
2024-03-03 22:31 ` Dmitry Torokhov
2024-03-04  9:55   ` [PATCH v2] Input: iqs269a - Use scope-based resource management " Markus Elfring
2024-03-04 17:10     ` Jeff LaBundy
2024-03-04 17:13       ` Dmitry Torokhov
2024-03-04 17:48         ` [v2] " Markus Elfring
2024-03-04 18:59           ` Dmitry Torokhov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox