summaryrefslogtreecommitdiff
path: root/drivers/mfd/88pm800.c
diff options
context:
space:
mode:
authorYi Zhang <yizhang@marvell.com>2013-06-14 09:21:45 +0400
committerSamuel Ortiz <sameo@linux.intel.com>2013-06-18 03:05:52 +0400
commit618fa57512c724d1d1a446162ad853249f8ac717 (patch)
tree7568b24b34cd808c41f753f597838f883df2e564 /drivers/mfd/88pm800.c
parentdc7d48635dd3c3fd5360238f7d2c697ff13abe7b (diff)
downloadlinux-618fa57512c724d1d1a446162ad853249f8ac717.tar.xz
mfd: 88pm800: Fix NULL pointer dereference
Move "device_800_init" to fix NULL pointer error when calling "device_gpadc_init" as it needs "subchip->regmap_gpadc" to set registers via regmap interface Signed-off-by: Yi Zhang <yizhang@marvell.com> Signed-off-by: Chao Xie <chao.xie@marvell.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/mfd/88pm800.c')
-rw-r--r--drivers/mfd/88pm800.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/drivers/mfd/88pm800.c b/drivers/mfd/88pm800.c
index 582bda543520..b2f9f0f9deb3 100644
--- a/drivers/mfd/88pm800.c
+++ b/drivers/mfd/88pm800.c
@@ -528,24 +528,26 @@ static int pm800_probe(struct i2c_client *client,
subchip->gpadc_page_addr = pdata->gpadc_page_addr;
chip->subchip = subchip;
- 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;
- }
-
ret = pm800_pages_init(chip);
if (ret) {
dev_err(&client->dev, "pm800_pages_init failed!\n");
goto err_page_init;
}
+ ret = device_800_init(chip, pdata);
+ if (ret) {
+ dev_err(chip->dev, "%s id 0x%x failed!\n", __func__, chip->id);
+ goto err_device_init;
+ }
+
if (pdata->plat_config)
pdata->plat_config(chip, pdata);
+ return 0;
+
+err_device_init:
+ pm800_pages_exit(chip);
err_page_init:
- mfd_remove_devices(chip->dev);
- device_irq_exit_800(chip);
err_subchip_alloc:
pm80x_deinit();
out_init: