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>] [day] [month] [year] [list]
Message-ID: <A874F61F95741C4A9BA573A70FE3998F41EF1C87@DQHE02.ent.ti.com>
Date:	Thu, 30 Aug 2012 11:38:20 +0000
From:	"Kim, Milo" <Milo.Kim@...com>
To:	Anton Vorontsov <cbouatmailru@...il.com>
CC:	Devendra Naga <develkernel412222@...il.com>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	David Woodhouse <dwmw2@...radead.org>,
	Anton Vorontsov <anton.vorontsov@...aro.org>
Subject: [PATCH 2/8] lp8727_charger: cleanup _probe() and _remove()

(a) register the power supply prior to creating irq handler
    After reordering the sequence, the interrupt issue can be gone
    when the power supply registration gets failed
(b) remove unnecessary goto statements
(c) unregister the power supply after releasing irq resources
    in reverse order of _probe()

Signed-off-by: Milo(Woogyom) Kim <milo.kim@...com>
---
 drivers/power/lp8727_charger.c |   20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/drivers/power/lp8727_charger.c b/drivers/power/lp8727_charger.c
index fb3d7ac..4d51909 100644
--- a/drivers/power/lp8727_charger.c
+++ b/drivers/power/lp8727_charger.c
@@ -442,35 +442,33 @@ static int lp8727_probe(struct i2c_client *cl, const struct i2c_device_id *id)
 	ret = lp8727_init_device(pchg);
 	if (ret) {
 		dev_err(pchg->dev, "i2c communication err: %d", ret);
-		goto error;
+		return ret;
 	}
 
-	ret = lp8727_intr_config(pchg);
+	ret = lp8727_register_psy(pchg);
 	if (ret) {
-		dev_err(pchg->dev, "irq handler err: %d", ret);
-		goto error;
+		dev_err(pchg->dev, "power supplies register err: %d", ret);
+		return ret;
 	}
 
-	ret = lp8727_register_psy(pchg);
+	ret = lp8727_intr_config(pchg);
 	if (ret) {
-		dev_err(pchg->dev, "power supplies register err: %d", ret);
-		goto error;
+		dev_err(pchg->dev, "irq handler err: %d", ret);
+		lp8727_unregister_psy(pchg);
+		return ret;
 	}
 
 	return 0;
-
-error:
-	return ret;
 }
 
 static int __devexit lp8727_remove(struct i2c_client *cl)
 {
 	struct lp8727_chg *pchg = i2c_get_clientdata(cl);
 
-	lp8727_unregister_psy(pchg);
 	free_irq(pchg->client->irq, pchg);
 	flush_workqueue(pchg->irqthread);
 	destroy_workqueue(pchg->irqthread);
+	lp8727_unregister_psy(pchg);
 	return 0;
 }
 
-- 
1.7.9.5


Best Regards,
Milo


--
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