aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/power/max8903_charger.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/power/max8903_charger.c b/drivers/power/max8903_charger.c
index 14e2b96d93b0..08f0d7909b6b 100644
--- a/drivers/power/max8903_charger.c
+++ b/drivers/power/max8903_charger.c
@@ -189,7 +189,7 @@ static int max8903_probe(struct platform_device *pdev)
189 int ta_in = 0; 189 int ta_in = 0;
190 int usb_in = 0; 190 int usb_in = 0;
191 191
192 data = kzalloc(sizeof(struct max8903_data), GFP_KERNEL); 192 data = devm_kzalloc(dev, sizeof(struct max8903_data), GFP_KERNEL);
193 if (data == NULL) { 193 if (data == NULL) {
194 dev_err(dev, "Cannot allocate memory.\n"); 194 dev_err(dev, "Cannot allocate memory.\n");
195 return -ENOMEM; 195 return -ENOMEM;
@@ -341,7 +341,6 @@ err_dc_irq:
341err_psy: 341err_psy:
342 power_supply_unregister(&data->psy); 342 power_supply_unregister(&data->psy);
343err: 343err:
344 kfree(data);
345 return ret; 344 return ret;
346} 345}
347 346
@@ -359,7 +358,6 @@ static int max8903_remove(struct platform_device *pdev)
359 if (pdata->dc_valid) 358 if (pdata->dc_valid)
360 free_irq(gpio_to_irq(pdata->dok), data); 359 free_irq(gpio_to_irq(pdata->dok), data);
361 power_supply_unregister(&data->psy); 360 power_supply_unregister(&data->psy);
362 kfree(data);
363 } 361 }
364 362
365 return 0; 363 return 0;