From: SF Markus Elfring <elfring@users.sourceforge.net>
To: linux-i2c@vger.kernel.org, Jean Delvare <jdelvare@suse.com>,
Wolfram Sang <wsa@the-dreams.de>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH] I2C-PIIX4: Use common error handling code in piix4_probe()
Date: Wed, 25 Oct 2017 13:40:55 +0200 [thread overview]
Message-ID: <be36ce5f-9e75-6c05-86a2-ea8368f09dc1@users.sourceforge.net> (raw)
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 25 Oct 2017 13:30:18 +0200
Add a jump target so that a bit of exception handling can be better reused
at the end of this function.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/i2c/busses/i2c-piix4.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c
index 0ecdb47a23ab..22cc56e9f304 100644
--- a/drivers/i2c/busses/i2c-piix4.c
+++ b/drivers/i2c/busses/i2c-piix4.c
@@ -780,20 +780,16 @@ static int piix4_probe(struct pci_dev *dev, const struct pci_device_id *id)
/* base address location etc changed in SB800 */
retval = piix4_setup_sb800(dev, id, 0);
- if (retval < 0) {
- release_region(SB800_PIIX4_SMB_IDX, 2);
- return retval;
- }
+ if (retval < 0)
+ goto release_region;
/*
* Try to register multiplexed main SMBus adapter,
* give up if we can't
*/
retval = piix4_add_adapters_sb800(dev, retval);
- if (retval < 0) {
- release_region(SB800_PIIX4_SMB_IDX, 2);
- return retval;
- }
+ if (retval < 0)
+ goto release_region;
} else {
retval = piix4_setup(dev, id);
if (retval < 0)
@@ -833,6 +829,10 @@ static int piix4_probe(struct pci_dev *dev, const struct pci_device_id *id)
}
return 0;
+
+release_region:
+ release_region(SB800_PIIX4_SMB_IDX, 2);
+ return retval;
}
static void piix4_adap_remove(struct i2c_adapter *adap)
--
2.14.3
next reply other threads:[~2017-10-25 11:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-25 11:40 SF Markus Elfring [this message]
2017-10-25 14:33 ` Jean Delvare
2017-10-25 14:37 ` 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=be36ce5f-9e75-6c05-86a2-ea8368f09dc1@users.sourceforge.net \
--to=elfring@users.sourceforge.net \
--cc=jdelvare@suse.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
Powered by JetHome