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-next>] [day] [month] [year] [list]
Message-Id: <1294047419.25173.2.camel@mola>
Date:	Mon, 03 Jan 2011 17:36:59 +0800
From:	Axel Lin <axel.lin@...il.com>
To:	linux-kernel@...r.kernel.org
Cc:	Uwe Kleine-König 
	<u.kleine-koenig@...gutronix.de>,
	Samuel Ortiz <sameo@...ux.intel.com>
Subject: [PATCH] mfd: Move error handling to the end of mc13xxx_probe

To improve readability, move error handling to the end of mc13xxx_probe.

Signed-off-by: Axel Lin <axel.lin@...il.com>
---
 drivers/mfd/mc13xxx-core.c |   22 ++++++++++------------
 1 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/drivers/mfd/mc13xxx-core.c b/drivers/mfd/mc13xxx-core.c
index b9fcaf0..18c29fc 100644
--- a/drivers/mfd/mc13xxx-core.c
+++ b/drivers/mfd/mc13xxx-core.c
@@ -732,28 +732,21 @@ static int mc13xxx_probe(struct spi_device *spi)
 
 	ret = mc13xxx_identify(mc13xxx, &id);
 	if (ret || id == MC13XXX_ID_INVALID)
-		goto err_revision;
+		goto err;
 
 	/* mask all irqs */
 	ret = mc13xxx_reg_write(mc13xxx, MC13XXX_IRQMASK0, 0x00ffffff);
 	if (ret)
-		goto err_mask;
+		goto err;
 
 	ret = mc13xxx_reg_write(mc13xxx, MC13XXX_IRQMASK1, 0x00ffffff);
 	if (ret)
-		goto err_mask;
+		goto err;
 
 	ret = request_threaded_irq(spi->irq, NULL, mc13xxx_irq_thread,
 			IRQF_ONESHOT | IRQF_TRIGGER_HIGH, "mc13xxx", mc13xxx);
-
-	if (ret) {
-err_mask:
-err_revision:
-		mc13xxx_unlock(mc13xxx);
-		dev_set_drvdata(&spi->dev, NULL);
-		kfree(mc13xxx);
-		return ret;
-	}
+	if (ret)
+		goto err;
 
 	mc13xxx_unlock(mc13xxx);
 
@@ -785,6 +778,11 @@ err_revision:
 	}
 
 	return 0;
+err:
+	mc13xxx_unlock(mc13xxx);
+	dev_set_drvdata(&spi->dev, NULL);
+	kfree(mc13xxx);
+	return ret;
 }
 
 static int __devexit mc13xxx_remove(struct spi_device *spi)
-- 
1.7.2



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ