From: SF Markus Elfring <elfring@users.sourceforge.net>
To: linux-gpio@vger.kernel.org,
Linus Walleij <linus.walleij@linaro.org>,
Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH 2/3] pinctrl: mcp23s08: Use common error handling code in mcp23s08_dbg_show()
Date: Mon, 30 Oct 2017 16:47:55 +0100 [thread overview]
Message-ID: <3e95d8b5-8306-ae4c-487b-44c6dc1811d6@users.sourceforge.net> (raw)
In-Reply-To: <ca1c3c19-7e8c-90f0-493c-b6fae04e6a03@users.sourceforge.net>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 30 Oct 2017 16:26:09 +0100
* The script "checkpatch.pl" pointed information out like the following.
WARNING: Prefer seq_puts to seq_printf
Thus fix the affected source code places.
* Adjust jump targets so that a bit of exception handling can be better
reused at the end of this function.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/pinctrl/pinctrl-mcp23s08.c | 34 +++++++++++++++++-----------------
1 file changed, 17 insertions(+), 17 deletions(-)
diff --git a/drivers/pinctrl/pinctrl-mcp23s08.c b/drivers/pinctrl/pinctrl-mcp23s08.c
index 919eb7268331..d1a7c627dbb9 100644
--- a/drivers/pinctrl/pinctrl-mcp23s08.c
+++ b/drivers/pinctrl/pinctrl-mcp23s08.c
@@ -723,25 +723,20 @@ static void mcp23s08_dbg_show(struct seq_file *s, struct gpio_chip *chip)
mutex_lock(&mcp->lock);
t = __check_mcp23s08_reg_cache(mcp);
- if (t) {
- seq_printf(s, " I/O Error\n");
- goto done;
- }
+ if (t)
+ goto report_failure;
+
t = mcp_read(mcp, MCP_IODIR, &iodir);
- if (t) {
- seq_printf(s, " I/O Error\n");
- goto done;
- }
+ if (t)
+ goto report_failure;
+
t = mcp_read(mcp, MCP_GPIO, &gpio);
- if (t) {
- seq_printf(s, " I/O Error\n");
- goto done;
- }
+ if (t)
+ goto report_failure;
+
t = mcp_read(mcp, MCP_GPPU, &gppu);
- if (t) {
- seq_printf(s, " I/O Error\n");
- goto done;
- }
+ if (t)
+ goto report_failure;
for (t = 0, mask = BIT(0); t < chip->ngpio; t++, mask <<= 1) {
const char *label;
@@ -758,8 +753,13 @@ static void mcp23s08_dbg_show(struct seq_file *s, struct gpio_chip *chip)
/* NOTE: ignoring the irq-related registers */
seq_puts(s, "\n");
}
-done:
+unlock:
mutex_unlock(&mcp->lock);
+ return;
+
+report_failure:
+ seq_puts(s, " I/O Error\n");
+ goto unlock;
}
#else
--
2.14.3
next prev parent reply other threads:[~2017-10-30 15:48 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-30 15:45 [PATCH 0/3] pinctrl-mcp23s08: Fine-tuning for two function implementations SF Markus Elfring
2017-10-30 15:46 ` [PATCH 1/3] pinctrl: mcp23s08: Improve unlocking of a mutex in mcp23s08_irq() SF Markus Elfring
2017-11-29 12:51 ` Linus Walleij
2017-10-30 15:47 ` SF Markus Elfring [this message]
2017-11-29 12:55 ` [PATCH 2/3] pinctrl: mcp23s08: Use common error handling code in mcp23s08_dbg_show() Linus Walleij
2017-10-30 15:49 ` [PATCH 3/3] pinctrl: mcp23s08: Combine two function calls " SF Markus Elfring
2017-11-29 12:56 ` Linus Walleij
2017-11-29 14:04 ` [3/3] " SF Markus Elfring
2018-01-06 19:52 ` [PATCH v2] pinctrl: mcp23s08: Combine two function calls into one " SF Markus Elfring
2018-01-09 14:10 ` Linus Walleij
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=3e95d8b5-8306-ae4c-487b-44c6dc1811d6@users.sourceforge.net \
--to=elfring@users.sourceforge.net \
--cc=kernel-janitors@vger.kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sebastian.reichel@collabora.co.uk \
/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
Powered by JetHome