lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5c3361c6-ef1d-b919-8817-05c2c98fb2ef@users.sourceforge.net>
Date:   Mon, 12 Mar 2018 12:31:44 +0100
From:   SF Markus Elfring <elfring@...rs.sourceforge.net>
To:     linux-bluetooth@...r.kernel.org,
        Johan Hedberg <johan.hedberg@...il.com>,
        Marcel Holtmann <marcel@...tmann.org>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        kernel-janitors@...r.kernel.org
Subject: [PATCH 1/5] Bluetooth: btmrvl: Use common error handling code in
 btmrvl_sdio_register_dev()

From: Markus Elfring <elfring@...rs.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@...rs.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ