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] [day] [month] [year] [list]
Message-ID: <1369307447-17874-4-git-send-email-yizhang.mrvl@gmail.com>
Date:	Thu, 23 May 2013 19:10:46 +0800
From:	<yizhang.mrvl@...il.com>
To:	<sameo@...ux.intel.com>, <gregkh@...uxfoundation.org>,
	<yizhang.mrvl@...il.com>
CC:	<cxie4@...vell.com>, <arnd@...db.de>, <yizhang@...vell.com>,
	<linux-kernel@...r.kernel.org>, <jtzhou@...vell.com>
Subject: [PATCH 3/4] mfd: 88pm800: fix probe bug

From: Yi Zhang <yizhang@...vell.com>

1) return 0 when probe function is successful
2) fine-tune pm800_pages_init()

Signed-off-by: Yi Zhang <yizhang@...vell.com>
---
 drivers/mfd/88pm800.c |   29 +++++++++++++++++++++--------
 1 files changed, 21 insertions(+), 8 deletions(-)

diff --git a/drivers/mfd/88pm800.c b/drivers/mfd/88pm800.c
index 618a6b9..475b5fa 100644
--- a/drivers/mfd/88pm800.c
+++ b/drivers/mfd/88pm800.c
@@ -369,32 +369,43 @@ static int pm800_pages_init(struct pm80x_chip *chip)
 	struct pm80x_subchip *subchip;
 	struct i2c_client *client = chip->client;
 
+	int ret = -ENODEV;
+
 	subchip = chip->subchip;
 	/* PM800 block power: i2c addr 0x31 */
-	if (subchip->power_page_addr) {
+	if (subchip & (subchip->power_page_addr)) {
 		subchip->power_page =
 		    i2c_new_dummy(client->adapter, subchip->power_page_addr);
 		subchip->regmap_power =
 		    devm_regmap_init_i2c(subchip->power_page,
 					 &pm80x_regmap_config);
 		i2c_set_clientdata(subchip->power_page, chip);
-	} else
+	} else {
 		dev_info(chip->dev,
 			 "PM800 block power 0x31: No power_page_addr\n");
+		return ret;
+	}
 
 	/* PM800 block GPADC: i2c addr 0x32 */
-	if (subchip->gpadc_page_addr) {
+	if (subchip & (subchip->gpadc_page_addr)) {
 		subchip->gpadc_page = i2c_new_dummy(client->adapter,
 						    subchip->gpadc_page_addr);
 		subchip->regmap_gpadc =
 		    devm_regmap_init_i2c(subchip->gpadc_page,
 					 &pm80x_regmap_config);
 		i2c_set_clientdata(subchip->gpadc_page, chip);
-	} else
+	} else {
 		dev_info(chip->dev,
 			 "PM800 block GPADC 0x32: No gpadc_page_addr\n");
+		goto out_gpadc_page;
+	}
 
 	return 0;
+
+out_gpadc_page:
+	regmap_exit(subchip->regmap_power);
+	i2c_unregister_device(subchip->power_page);
+	return ret;
 }
 
 static void pm800_pages_exit(struct pm80x_chip *chip)
@@ -537,16 +548,18 @@ static int pm800_probe(struct i2c_client *client,
 	ret = device_800_init(chip, pdata);
 	if (ret) {
 		dev_err(chip->dev, "%s id 0x%x failed!\n", __func__, chip->id);
-		goto err_subchip_alloc;
+		goto err_800_init;
 	}
 
 	if (pdata->plat_config)
 		pdata->plat_config(chip, pdata);
 
-err_subchip_alloc:
-	mfd_remove_devices(chip->dev);
-	device_irq_exit_800(chip);
+	return 0;
+
+err_800_init:
+	pm800_pages_exit(chip);
 err_page_init:
+err_subchip_alloc:
 	pm80x_deinit();
 out_init:
 	return ret;
-- 
1.7.0.4

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