Commit f3f66b3ea46237a0810d09279a38b5413aaf5d5e
Committed by
Anton Vorontsov
1 parent
d4a20f57d3
Exists in
master
and in
20 other branches
max8903_charger: Use devm_kzalloc()
Use devm_kzalloc() to make cleanup paths more simple. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
Showing 1 changed file with 1 additions and 3 deletions Side-by-side Diff
drivers/power/max8903_charger.c
... | ... | @@ -189,7 +189,7 @@ |
189 | 189 | int ta_in = 0; |
190 | 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 | 193 | if (data == NULL) { |
194 | 194 | dev_err(dev, "Cannot allocate memory.\n"); |
195 | 195 | return -ENOMEM; |
... | ... | @@ -341,7 +341,6 @@ |
341 | 341 | err_psy: |
342 | 342 | power_supply_unregister(&data->psy); |
343 | 343 | err: |
344 | - kfree(data); | |
345 | 344 | return ret; |
346 | 345 | } |
347 | 346 | |
... | ... | @@ -359,7 +358,6 @@ |
359 | 358 | if (pdata->dc_valid) |
360 | 359 | free_irq(gpio_to_irq(pdata->dok), data); |
361 | 360 | power_supply_unregister(&data->psy); |
362 | - kfree(data); | |
363 | 361 | } |
364 | 362 | |
365 | 363 | return 0; |