diff --git a/drivers/power/max8925_power.c b/drivers/power/max8925_power.c index 57eb5c2bfc21..3b94620ce5c1 100644 --- a/drivers/power/max8925_power.c +++ b/drivers/power/max8925_power.c @@ -540,14 +540,14 @@ static int max8925_power_probe(struct platform_device *pdev) info->usb = power_supply_register(&pdev->dev, &usb_desc, &psy_cfg); if (IS_ERR(info->usb)) { ret = PTR_ERR(info->usb); - goto out_usb; + goto out_unregister_ac; } info->usb->dev.parent = &pdev->dev; info->battery = power_supply_register(&pdev->dev, &battery_desc, NULL); if (IS_ERR(info->battery)) { ret = PTR_ERR(info->battery); - goto out_battery; + goto out_unregister_usb; } info->battery->dev.parent = &pdev->dev; @@ -560,9 +560,9 @@ static int max8925_power_probe(struct platform_device *pdev) max8925_init_charger(chip, info); return 0; -out_battery: - power_supply_unregister(info->battery); -out_usb: +out_unregister_usb: + power_supply_unregister(info->usb); +out_unregister_ac: power_supply_unregister(info->ac); out: return ret;