From: SF Markus Elfring <elfring@users.sourceforge.net>
To: linux-bluetooth@vger.kernel.org,
Johan Hedberg <johan.hedberg@gmail.com>,
Marcel Holtmann <marcel@holtmann.org>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH 1/5] Bluetooth: btmrvl: Use common error handling code in btmrvl_sdio_register_dev()
Date: Mon, 12 Mar 2018 12:31:44 +0100 [thread overview]
Message-ID: <5c3361c6-ef1d-b919-8817-05c2c98fb2ef@users.sourceforge.net> (raw)
In-Reply-To: <8d050f76-aed1-7b6b-8778-a78aef34d4ea@users.sourceforge.net>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 12 Mar 2018 10:15:17 +0100
Adjust 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/bluetooth/btmrvl_sdio.c | 50 ++++++++++++++++-------------------------
1 file changed, 19 insertions(+), 31 deletions(-)
diff --git a/drivers/bluetooth/btmrvl_sdio.c b/drivers/bluetooth/btmrvl_sdio.c
index 0f020254fd39..df2a04bd8428 100644
--- a/drivers/bluetooth/btmrvl_sdio.c
+++ b/drivers/bluetooth/btmrvl_sdio.c
@@ -949,31 +949,24 @@ static int btmrvl_sdio_register_dev(struct btmrvl_sdio_card *card)
ret = sdio_set_block_size(card->func, SDIO_BLOCK_SIZE);
if (ret) {
BT_ERR("cannot set SDIO block size");
- ret = -EIO;
- goto release_irq;
+ goto release_with_eio;
}
reg = sdio_readb(func, card->reg->io_port_0, &ret);
- if (ret < 0) {
- ret = -EIO;
- goto release_irq;
- }
+ if (ret < 0)
+ goto release_with_eio;
card->ioport = reg;
reg = sdio_readb(func, card->reg->io_port_1, &ret);
- if (ret < 0) {
- ret = -EIO;
- goto release_irq;
- }
+ if (ret < 0)
+ goto release_with_eio;
card->ioport |= (reg << 8);
reg = sdio_readb(func, card->reg->io_port_2, &ret);
- if (ret < 0) {
- ret = -EIO;
- goto release_irq;
- }
+ if (ret < 0)
+ goto release_with_eio;
card->ioport |= (reg << 16);
@@ -981,26 +974,20 @@ static int btmrvl_sdio_register_dev(struct btmrvl_sdio_card *card)
if (card->reg->int_read_to_clear) {
reg = sdio_readb(func, card->reg->host_int_rsr, &ret);
- if (ret < 0) {
- ret = -EIO;
- goto release_irq;
- }
+ if (ret < 0)
+ goto release_with_eio;
+
sdio_writeb(func, reg | 0x3f, card->reg->host_int_rsr, &ret);
- if (ret < 0) {
- ret = -EIO;
- goto release_irq;
- }
+ if (ret < 0)
+ goto release_with_eio;
reg = sdio_readb(func, card->reg->card_misc_cfg, &ret);
- if (ret < 0) {
- ret = -EIO;
- goto release_irq;
- }
+ if (ret < 0)
+ goto release_with_eio;
+
sdio_writeb(func, reg | 0x10, card->reg->card_misc_cfg, &ret);
- if (ret < 0) {
- ret = -EIO;
- goto release_irq;
- }
+ if (ret < 0)
+ goto release_with_eio;
}
sdio_set_drvdata(func, card);
@@ -1009,7 +996,8 @@ static int btmrvl_sdio_register_dev(struct btmrvl_sdio_card *card)
return 0;
-release_irq:
+release_with_eio:
+ ret = -EIO;
sdio_release_irq(func);
disable_func:
--
2.16.2
next prev parent reply other threads:[~2018-03-12 11:31 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-12 11:30 [PATCH 0/5] Bluetooth/btmrvl_sdio: Adjustments for three function implementations SF Markus Elfring
2018-03-12 11:31 ` SF Markus Elfring [this message]
2018-03-12 16:18 ` [PATCH 1/5] Bluetooth: btmrvl: Use common error handling code in btmrvl_sdio_register_dev() Marcel Holtmann
2018-03-12 11:32 ` [PATCH 2/5] Bluetooth: btmrvl: Delete an unnecessary variable initialisation " SF Markus Elfring
2018-03-12 16:11 ` Marcel Holtmann
2018-03-12 11:33 ` [PATCH 3/5] Bluetooth: btmrvl: One check less in btmrvl_sdio_card_to_host() after error detection SF Markus Elfring
2018-03-12 16:12 ` Marcel Holtmann
2018-03-13 7:46 ` [3/5] Bluetooth: btmrvl: One check less in btmrvl_sdio_card_to_host() SF Markus Elfring
2018-03-12 11:34 ` [PATCH 4/5] Bluetooth: btmrvl: Delete an unnecessary variable initialisation " SF Markus Elfring
2018-03-12 16:11 ` Marcel Holtmann
2018-03-12 11:35 ` [PATCH 5/5] Bluetooth: btmrvl: Use common error handling code in btmrvl_sdio_download_fw_w_helper() SF Markus Elfring
2018-03-12 16:06 ` Marcel Holtmann
2018-03-13 7:55 ` 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=5c3361c6-ef1d-b919-8817-05c2c98fb2ef@users.sourceforge.net \
--to=elfring@users.sourceforge.net \
--cc=johan.hedberg@gmail.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-bluetooth@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marcel@holtmann.org \
/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).