summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorGraeme Gregory <gg@slimlogic.co.uk>2012-08-28 15:47:35 +0400
committerSamuel Ortiz <sameo@linux.intel.com>2012-09-22 01:40:36 +0400
commit3f78decc321d48724809406b498708d2ab4b93d2 (patch)
treee2b0b9a564e6f9f33b0aed4ff92eb5c97ad739a9 /drivers
parent81a21cddaf14bd1144c2d173add7cbdeb95a07ca (diff)
downloadlinux-3f78decc321d48724809406b498708d2ab4b93d2.tar.xz
mfd: palmas: Improve the error exit path
Improve the error exit path so that we correctly de-allocate resources that have been allocated upto the point where error occurs. Signed-off-by: Graeme Gregory <gg@slimlogic.co.uk> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mfd/palmas.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/drivers/mfd/palmas.c b/drivers/mfd/palmas.c
index e7a7415b8c2b..5831dfdb3f4c 100644
--- a/drivers/mfd/palmas.c
+++ b/drivers/mfd/palmas.c
@@ -377,11 +377,11 @@ static int __devinit palmas_i2c_probe(struct i2c_client *i2c,
reg = pdata->pad1;
ret = regmap_write(palmas->regmap[slave], addr, reg);
if (ret)
- goto err;
+ goto err_irq;
} else {
ret = regmap_read(palmas->regmap[slave], addr, &reg);
if (ret)
- goto err;
+ goto err_irq;
}
if (!(reg & PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_0))
@@ -412,11 +412,11 @@ static int __devinit palmas_i2c_probe(struct i2c_client *i2c,
reg = pdata->pad2;
ret = regmap_write(palmas->regmap[slave], addr, reg);
if (ret)
- goto err;
+ goto err_irq;
} else {
ret = regmap_read(palmas->regmap[slave], addr, &reg);
if (ret)
- goto err;
+ goto err_irq;
}
if (!(reg & PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_4))
@@ -439,13 +439,13 @@ static int __devinit palmas_i2c_probe(struct i2c_client *i2c,
ret = regmap_write(palmas->regmap[slave], addr, reg);
if (ret)
- goto err;
+ goto err_irq;
children = kmemdup(palmas_children, sizeof(palmas_children),
GFP_KERNEL);
if (!children) {
ret = -ENOMEM;
- goto err;
+ goto err_irq;
}
children[PALMAS_PMIC_ID].platform_data = pdata->pmic_pdata;
@@ -458,12 +458,15 @@ static int __devinit palmas_i2c_probe(struct i2c_client *i2c,
kfree(children);
if (ret < 0)
- goto err;
+ goto err_devices;
return ret;
-err:
+err_devices:
mfd_remove_devices(palmas->dev);
+err_irq:
+ regmap_del_irq_chip(palmas->irq, palmas->irq_data);
+err:
return ret;
}