aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd/adp5520.c
diff options
context:
space:
mode:
authorLee Jones <lee.jones@linaro.org>2013-05-23 11:25:08 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2013-06-13 06:11:41 -0400
commit76ba0b896bed38f7be13682a0170074a5235f1be (patch)
treedfd503e250c0db7ccded0356473a11f8a4ff1832 /drivers/mfd/adp5520.c
parentc211b6b9c0144a531f08f0f975b45ecee895ae50 (diff)
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,
223 return -ENODEV; 223 return -ENODEV;
224 } 224 }
225 225
226 chip = kzalloc(sizeof(*chip), GFP_KERNEL); 226 chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL);
227 if (!chip) 227 if (!chip)
228 return -ENOMEM; 228 return -ENOMEM;
229 229
@@ -244,7 +244,7 @@ static int adp5520_probe(struct i2c_client *client,
244 if (ret) { 244 if (ret) {
245 dev_err(&client->dev, "failed to request irq %d\n", 245 dev_err(&client->dev, "failed to request irq %d\n",
246 chip->irq); 246 chip->irq);
247 goto out_free_chip; 247 return ret;
248 } 248 }
249 } 249 }
250 250
@@ -302,9 +302,6 @@ out_free_irq:
302 if (chip->irq) 302 if (chip->irq)
303 free_irq(chip->irq, chip); 303 free_irq(chip->irq, chip);
304 304
305out_free_chip:
306 kfree(chip);
307
308 return ret; 305 return ret;
309} 306}
310 307
@@ -317,7 +314,6 @@ static int adp5520_remove(struct i2c_client *client)
317 314
318 adp5520_remove_subdevs(chip); 315 adp5520_remove_subdevs(chip);
319 adp5520_write(chip->dev, ADP5520_MODE_STATUS, 0); 316 adp5520_write(chip->dev, ADP5520_MODE_STATUS, 0);
320 kfree(chip);
321 return 0; 317 return 0;
322} 318}
323 319