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

max8925_power: 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
feeb3a92 bc67ea8e

+2 -3
+2 -3
drivers/power/max8925_power.c
··· 489 489 return -EINVAL; 490 490 } 491 491 492 - info = kzalloc(sizeof(struct max8925_power_info), GFP_KERNEL); 492 + info = devm_kzalloc(&pdev->dev, sizeof(struct max8925_power_info), 493 + GFP_KERNEL); 493 494 if (!info) 494 495 return -ENOMEM; 495 496 info->chip = chip; ··· 547 546 out_usb: 548 547 power_supply_unregister(&info->ac); 549 548 out: 550 - kfree(info); 551 549 return ret; 552 550 } 553 551 ··· 559 559 power_supply_unregister(&info->usb); 560 560 power_supply_unregister(&info->battery); 561 561 max8925_deinit_charger(info); 562 - kfree(info); 563 562 } 564 563 return 0; 565 564 }