From: SF Markus Elfring <elfring@users.sourceforge.net>
To: linux-i2c@vger.kernel.org, David Daney <david.daney@cavium.com>,
Jan Glauber <jglauber@cavium.com>,
Wolfram Sang <wsa@the-dreams.de>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH] I2C-Octeon: Use common error handling code in octeon_i2c_probe()
Date: Wed, 25 Oct 2017 11:52:28 +0200 [thread overview]
Message-ID: <73affb84-9cdd-9f5c-b96a-5a392739e789@users.sourceforge.net> (raw)
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 25 Oct 2017 11:45:48 +0200
Add a jump target so that a specific error message is stored only once
at the end of this function implementation.
Replace two calls of the function "dev_err" by goto statements.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/i2c/busses/i2c-octeon-platdrv.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/drivers/i2c/busses/i2c-octeon-platdrv.c b/drivers/i2c/busses/i2c-octeon-platdrv.c
index 64bda83e65ac..ac8a1099c523 100644
--- a/drivers/i2c/busses/i2c-octeon-platdrv.c
+++ b/drivers/i2c/busses/i2c-octeon-platdrv.c
@@ -207,10 +207,8 @@ static int octeon_i2c_probe(struct platform_device *pdev)
result = devm_request_irq(&pdev->dev, i2c->hlc_irq,
octeon_i2c_hlc_isr78, 0,
DRV_NAME, i2c);
- if (result < 0) {
- dev_err(i2c->dev, "failed to attach interrupt\n");
- goto out;
- }
+ if (result < 0)
+ goto report_failure;
} else {
i2c->int_enable = octeon_i2c_int_enable;
i2c->int_disable = octeon_i2c_int_disable;
@@ -220,10 +218,8 @@ static int octeon_i2c_probe(struct platform_device *pdev)
result = devm_request_irq(&pdev->dev, i2c->irq,
octeon_i2c_isr, 0, DRV_NAME, i2c);
- if (result < 0) {
- dev_err(i2c->dev, "failed to attach interrupt\n");
- goto out;
- }
+ if (result < 0)
+ goto report_failure;
if (OCTEON_IS_MODEL(OCTEON_CN38XX))
i2c->broken_irq_check = true;
@@ -251,6 +247,8 @@ static int octeon_i2c_probe(struct platform_device *pdev)
dev_info(i2c->dev, "probed\n");
return 0;
+report_failure:
+ dev_err(i2c->dev, "failed to attach interrupt\n");
out:
return result;
};
--
2.14.3
next reply other threads:[~2017-10-25 9:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-25 9:52 SF Markus Elfring [this message]
2017-10-25 15:52 ` [PATCH] I2C-Octeon: Use common error handling code in octeon_i2c_probe() David Daney
2017-10-26 5:00 ` SF Markus Elfring
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=73affb84-9cdd-9f5c-b96a-5a392739e789@users.sourceforge.net \
--to=elfring@users.sourceforge.net \
--cc=david.daney@cavium.com \
--cc=jglauber@cavium.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=wsa@the-dreams.de \
/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;
as well as URLs for NNTP newsgroup(s).