summaryrefslogtreecommitdiff
path: root/drivers/mfd/pm8921-core.c
diff options
context:
space:
mode:
authorJingoo Han <jg1.han@samsung.com>2013-08-20 11:02:26 +0400
committerLee Jones <lee.jones@linaro.org>2013-08-20 11:51:04 +0400
commitb2cdcfacfe4bafaaeeba54db5940eef6452d1161 (patch)
tree10ec32ff807510597f40117a37f36ef01a1d5a1a /drivers/mfd/pm8921-core.c
parent5cddd5de8cc8b3bcf11ecd530f7e0cbcb283d968 (diff)
downloadlinux-b2cdcfacfe4bafaaeeba54db5940eef6452d1161.tar.xz
mfd: pm8921: Use devm_*() functions
Use devm_*() functions to make cleanup paths simpler. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
Diffstat (limited to 'drivers/mfd/pm8921-core.c')
-rw-r--r--drivers/mfd/pm8921-core.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/mfd/pm8921-core.c b/drivers/mfd/pm8921-core.c
index 9a7c991a3826..a6841f77aa5e 100644
--- a/drivers/mfd/pm8921-core.c
+++ b/drivers/mfd/pm8921-core.c
@@ -118,7 +118,7 @@ static int pm8921_probe(struct platform_device *pdev)
return -EINVAL;
}
- pmic = kzalloc(sizeof(struct pm8921), GFP_KERNEL);
+ pmic = devm_kzalloc(&pdev->dev, sizeof(struct pm8921), GFP_KERNEL);
if (!pmic) {
pr_err("Cannot alloc pm8921 struct\n");
return -ENOMEM;
@@ -128,7 +128,7 @@ static int pm8921_probe(struct platform_device *pdev)
rc = ssbi_read(pdev->dev.parent, REG_HWREV, &val, sizeof(val));
if (rc) {
pr_err("Failed to read hw rev reg %d:rc=%d\n", REG_HWREV, rc);
- goto err_read_rev;
+ return rc;
}
pr_info("PMIC revision 1: %02X\n", val);
rev = val;
@@ -138,7 +138,7 @@ static int pm8921_probe(struct platform_device *pdev)
if (rc) {
pr_err("Failed to read hw rev 2 reg %d:rc=%d\n",
REG_HWREV_2, rc);
- goto err_read_rev;
+ return rc;
}
pr_info("PMIC revision 2: %02X\n", val);
rev |= val << BITS_PER_BYTE;
@@ -160,8 +160,6 @@ static int pm8921_probe(struct platform_device *pdev)
err:
mfd_remove_devices(pmic->dev);
-err_read_rev:
- kfree(pmic);
return rc;
}
@@ -179,7 +177,6 @@ static int pm8921_remove(struct platform_device *pdev)
pm8xxx_irq_exit(pmic->irq_chip);
pmic->irq_chip = NULL;
}
- kfree(pmic);
return 0;
}