aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/power
diff options
context:
space:
mode:
authorJingoo Han <jg1.han@samsung.com>2013-03-11 02:35:38 -0400
committerAnton Vorontsov <anton@enomsg.org>2013-04-01 02:25:32 -0400
commitc09dd7daba1d0d833075e4ee653ddc4e7f53a7e1 (patch)
treed36eb227da67a54dc9a9864487b1728f2d7f88e7 /drivers/power
parentb852ac51e25789846cb6257e737a9a1734a0d171 (diff)
pcf50633-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>
Diffstat (limited to 'drivers/power')
-rw-r--r--drivers/power/pcf50633-charger.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/drivers/power/pcf50633-charger.c b/drivers/power/pcf50633-charger.c
index c2122a7ad065..17fd77f24b2a 100644
--- a/drivers/power/pcf50633-charger.c
+++ b/drivers/power/pcf50633-charger.c
@@ -373,7 +373,7 @@ static int pcf50633_mbc_probe(struct platform_device *pdev)
373 int i; 373 int i;
374 u8 mbcs1; 374 u8 mbcs1;
375 375
376 mbc = kzalloc(sizeof(*mbc), GFP_KERNEL); 376 mbc = devm_kzalloc(&pdev->dev, sizeof(*mbc), GFP_KERNEL);
377 if (!mbc) 377 if (!mbc)
378 return -ENOMEM; 378 return -ENOMEM;
379 379
@@ -413,7 +413,6 @@ static int pcf50633_mbc_probe(struct platform_device *pdev)
413 ret = power_supply_register(&pdev->dev, &mbc->adapter); 413 ret = power_supply_register(&pdev->dev, &mbc->adapter);
414 if (ret) { 414 if (ret) {
415 dev_err(mbc->pcf->dev, "failed to register adapter\n"); 415 dev_err(mbc->pcf->dev, "failed to register adapter\n");
416 kfree(mbc);
417 return ret; 416 return ret;
418 } 417 }
419 418
@@ -421,7 +420,6 @@ static int pcf50633_mbc_probe(struct platform_device *pdev)
421 if (ret) { 420 if (ret) {
422 dev_err(mbc->pcf->dev, "failed to register usb\n"); 421 dev_err(mbc->pcf->dev, "failed to register usb\n");
423 power_supply_unregister(&mbc->adapter); 422 power_supply_unregister(&mbc->adapter);
424 kfree(mbc);
425 return ret; 423 return ret;
426 } 424 }
427 425
@@ -430,7 +428,6 @@ static int pcf50633_mbc_probe(struct platform_device *pdev)
430 dev_err(mbc->pcf->dev, "failed to register ac\n"); 428 dev_err(mbc->pcf->dev, "failed to register ac\n");
431 power_supply_unregister(&mbc->adapter); 429 power_supply_unregister(&mbc->adapter);
432 power_supply_unregister(&mbc->usb); 430 power_supply_unregister(&mbc->usb);
433 kfree(mbc);
434 return ret; 431 return ret;
435 } 432 }
436 433
@@ -461,8 +458,6 @@ static int pcf50633_mbc_remove(struct platform_device *pdev)
461 power_supply_unregister(&mbc->adapter); 458 power_supply_unregister(&mbc->adapter);
462 power_supply_unregister(&mbc->ac); 459 power_supply_unregister(&mbc->ac);
463 460
464 kfree(mbc);
465
466 return 0; 461 return 0;
467} 462}
468 463