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>
This commit is contained in:
parent
b852ac51e2
commit
c09dd7daba
1 changed files with 1 additions and 6 deletions
|
@ -373,7 +373,7 @@ static int pcf50633_mbc_probe(struct platform_device *pdev)
|
||||||
int i;
|
int i;
|
||||||
u8 mbcs1;
|
u8 mbcs1;
|
||||||
|
|
||||||
mbc = kzalloc(sizeof(*mbc), GFP_KERNEL);
|
mbc = devm_kzalloc(&pdev->dev, sizeof(*mbc), GFP_KERNEL);
|
||||||
if (!mbc)
|
if (!mbc)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
@ -413,7 +413,6 @@ static int pcf50633_mbc_probe(struct platform_device *pdev)
|
||||||
ret = power_supply_register(&pdev->dev, &mbc->adapter);
|
ret = power_supply_register(&pdev->dev, &mbc->adapter);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err(mbc->pcf->dev, "failed to register adapter\n");
|
dev_err(mbc->pcf->dev, "failed to register adapter\n");
|
||||||
kfree(mbc);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -421,7 +420,6 @@ static int pcf50633_mbc_probe(struct platform_device *pdev)
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err(mbc->pcf->dev, "failed to register usb\n");
|
dev_err(mbc->pcf->dev, "failed to register usb\n");
|
||||||
power_supply_unregister(&mbc->adapter);
|
power_supply_unregister(&mbc->adapter);
|
||||||
kfree(mbc);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -430,7 +428,6 @@ static int pcf50633_mbc_probe(struct platform_device *pdev)
|
||||||
dev_err(mbc->pcf->dev, "failed to register ac\n");
|
dev_err(mbc->pcf->dev, "failed to register ac\n");
|
||||||
power_supply_unregister(&mbc->adapter);
|
power_supply_unregister(&mbc->adapter);
|
||||||
power_supply_unregister(&mbc->usb);
|
power_supply_unregister(&mbc->usb);
|
||||||
kfree(mbc);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -461,8 +458,6 @@ static int pcf50633_mbc_remove(struct platform_device *pdev)
|
||||||
power_supply_unregister(&mbc->adapter);
|
power_supply_unregister(&mbc->adapter);
|
||||||
power_supply_unregister(&mbc->ac);
|
power_supply_unregister(&mbc->ac);
|
||||||
|
|
||||||
kfree(mbc);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue