mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-20 04:19:41 +00:00
power: supply: pcf50633-charger: Compress return logic into one line.
Simplify return logic to avoid unnecessary variable assignments. These issues were detected using Coccinelle and the following semantic patch: @@ local idexpression ret; expression e; @@ -ret = +return e; -return ret; Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
This commit is contained in:
parent
33237fb8f0
commit
e448e2d149
@ -393,7 +393,6 @@ static int pcf50633_mbc_probe(struct platform_device *pdev)
|
|||||||
{
|
{
|
||||||
struct power_supply_config psy_cfg = {};
|
struct power_supply_config psy_cfg = {};
|
||||||
struct pcf50633_mbc *mbc;
|
struct pcf50633_mbc *mbc;
|
||||||
int ret;
|
|
||||||
int i;
|
int i;
|
||||||
u8 mbcs1;
|
u8 mbcs1;
|
||||||
|
|
||||||
@ -419,8 +418,7 @@ static int pcf50633_mbc_probe(struct platform_device *pdev)
|
|||||||
&psy_cfg);
|
&psy_cfg);
|
||||||
if (IS_ERR(mbc->adapter)) {
|
if (IS_ERR(mbc->adapter)) {
|
||||||
dev_err(mbc->pcf->dev, "failed to register adapter\n");
|
dev_err(mbc->pcf->dev, "failed to register adapter\n");
|
||||||
ret = PTR_ERR(mbc->adapter);
|
return PTR_ERR(mbc->adapter);
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mbc->usb = power_supply_register(&pdev->dev, &pcf50633_mbc_usb_desc,
|
mbc->usb = power_supply_register(&pdev->dev, &pcf50633_mbc_usb_desc,
|
||||||
@ -428,8 +426,7 @@ static int pcf50633_mbc_probe(struct platform_device *pdev)
|
|||||||
if (IS_ERR(mbc->usb)) {
|
if (IS_ERR(mbc->usb)) {
|
||||||
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);
|
||||||
ret = PTR_ERR(mbc->usb);
|
return PTR_ERR(mbc->usb);
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mbc->ac = power_supply_register(&pdev->dev, &pcf50633_mbc_ac_desc,
|
mbc->ac = power_supply_register(&pdev->dev, &pcf50633_mbc_ac_desc,
|
||||||
@ -438,12 +435,10 @@ 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);
|
||||||
ret = PTR_ERR(mbc->ac);
|
return PTR_ERR(mbc->ac);
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = sysfs_create_group(&pdev->dev.kobj, &mbc_attr_group);
|
if (sysfs_create_group(&pdev->dev.kobj, &mbc_attr_group))
|
||||||
if (ret)
|
|
||||||
dev_err(mbc->pcf->dev, "failed to create sysfs entries\n");
|
dev_err(mbc->pcf->dev, "failed to create sysfs entries\n");
|
||||||
|
|
||||||
mbcs1 = pcf50633_reg_read(mbc->pcf, PCF50633_REG_MBCS1);
|
mbcs1 = pcf50633_reg_read(mbc->pcf, PCF50633_REG_MBCS1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user