From: <yizhang.mrvl@gmail.com>
To: <sameo@linux.intel.com>, <arnd@arndb.de>
Cc: <gregkh@linuxfoundation.org>, <cxie4@marvell.com>,
<jtzhou@marvell.com>, <yizhang@marvell.com>,
<linux-kernel@vger.kernel.org>
Subject: [PATCH v2 3/4] mfd: 88pm800: fix probe bug
Date: Tue, 28 May 2013 12:49:00 +0800 [thread overview]
Message-ID: <1369716541-20034-4-git-send-email-yizhang.mrvl@gmail.com> (raw)
In-Reply-To: <1369716541-20034-1-git-send-email-yizhang.mrvl@gmail.com>
From: Yi Zhang <yizhang@marvell.com>
1) return 0 when probe function is successful
2) fine-tune pm800_pages_init()
Signed-off-by: Yi Zhang <yizhang@marvell.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..2c68cbc 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.4.1
next prev parent reply other threads:[~2013-05-28 4:50 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-28 4:48 [PATCH v2 0/4] mfd: 88pm800: bug fix and regulator support yizhang.mrvl
2013-05-28 4:48 ` [PATCH v2 1/4] mfd: 88pm800: fix NULL pointer error yizhang.mrvl
2013-05-28 4:48 ` [PATCH v2 2/4] mfd: 88pm800: remove "IRQF_TRIGGER_FALLING" flag yizhang.mrvl
2013-05-28 4:49 ` yizhang.mrvl [this message]
2013-05-28 4:49 ` [PATCH v2 4/4] mfd: 88pm800: add regulator support yizhang.mrvl
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=1369716541-20034-4-git-send-email-yizhang.mrvl@gmail.com \
--to=yizhang.mrvl@gmail.com \
--cc=arnd@arndb.de \
--cc=cxie4@marvell.com \
--cc=gregkh@linuxfoundation.org \
--cc=jtzhou@marvell.com \
--cc=linux-kernel@vger.kernel.org \
--cc=sameo@linux.intel.com \
--cc=yizhang@marvell.com \
/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
all inboxes | Powered by JetHome®