public inbox for linux-input@vger.kernel.org
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: linux-input@vger.kernel.org, kernel-janitors@vger.kernel.org,
	"Dmitry Torokhov" <dmitry.torokhov@gmail.com>,
	"Jeff LaBundy" <jeff@labundy.com>,
	"Mattijs Korpershoek" <mkorpershoek@baylibre.com>,
	"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	"ye xingchen" <ye.xingchen@zte.com.cn>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH] Input: iqs269a - Use common error handling code in iqs269_parse_chan()
Date: Sat, 2 Mar 2024 09:24:53 +0100	[thread overview]
Message-ID: <6bf9f962-cf75-459d-89f4-2546063fc154@web.de> (raw)

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


             reply	other threads:[~2024-03-02  8:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-02  8:24 Markus Elfring [this message]
2024-03-03 22:31 ` [PATCH] Input: iqs269a - Use common error handling code in iqs269_parse_chan() 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6bf9f962-cf75-459d-89f4-2546063fc154@web.de \
    --to=markus.elfring@web.de \
    --cc=dmitry.torokhov@gmail.com \
    --cc=jeff@labundy.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mkorpershoek@baylibre.com \
    --cc=u.kleine-koenig@pengutronix.de \
    --cc=ye.xingchen@zte.com.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox