Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Jingoo Han and committed by
Anton Vorontsov
f3f66b3e d4a20f57

+1 -3
+1 -3
drivers/power/max8903_charger.c
··· 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 341 err_psy: 342 342 power_supply_unregister(&data->psy); 343 343 err: 344 - kfree(data); 345 344 return ret; 346 345 } 347 346 ··· 358 359 if (pdata->dc_valid) 359 360 free_irq(gpio_to_irq(pdata->dok), data); 360 361 power_supply_unregister(&data->psy); 361 - kfree(data); 362 362 } 363 363 364 364 return 0;