summaryrefslogtreecommitdiff
path: root/drivers/mfd/adp5520.c
diff options
context:
space:
mode:
authorLee Jones <lee.jones@linaro.org>2013-05-23 19:25:08 +0400
committerSamuel Ortiz <sameo@linux.intel.com>2013-06-13 14:11:41 +0400
commit76ba0b896bed38f7be13682a0170074a5235f1be (patch)
treedfd503e250c0db7ccded0356473a11f8a4ff1832 /drivers/mfd/adp5520.c
parentc211b6b9c0144a531f08f0f975b45ecee895ae50 (diff)
downloadlinux-76ba0b896bed38f7be13682a0170074a5235f1be.tar.xz
mfd: adp5520: Convert to managed resources for allocating memory
Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/mfd/adp5520.c')
-rw-r--r--drivers/mfd/adp5520.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/drivers/mfd/adp5520.c b/drivers/mfd/adp5520.c
index 0d2eba023439..28346ad0b4a6 100644
--- a/drivers/mfd/adp5520.c
+++ b/drivers/mfd/adp5520.c
@@ -223,7 +223,7 @@ static int adp5520_probe(struct i2c_client *client,
return -ENODEV;
}
- chip = kzalloc(sizeof(*chip), GFP_KERNEL);
+ chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL);
if (!chip)
return -ENOMEM;
@@ -244,7 +244,7 @@ static int adp5520_probe(struct i2c_client *client,
if (ret) {
dev_err(&client->dev, "failed to request irq %d\n",
chip->irq);
- goto out_free_chip;
+ return ret;
}
}
@@ -302,9 +302,6 @@ out_free_irq:
if (chip->irq)
free_irq(chip->irq, chip);
-out_free_chip:
- kfree(chip);
-
return ret;
}
@@ -317,7 +314,6 @@ static int adp5520_remove(struct i2c_client *client)
adp5520_remove_subdevs(chip);
adp5520_write(chip->dev, ADP5520_MODE_STATUS, 0);
- kfree(chip);
return 0;
}