power: qpnp-smbcharger: handle the regulator probe deferral properly

Currently, if regulator_register() of smbcharger-external-otg
regulator returns an error (e.g. -EPROBE_DEFER),
regulator_unregister() is not called for smbcharger-boost-otg
regulator which got registered before that.

This causes problems during bootup later because of an invalid
regulator device being left registered indefinitely.

Fix this by unregistering the regulator that got registered
already when there is an error in registering the other.

CRs-Fixed: 895622
Change-Id: I363693888f357555dbb82ef2566ed855cea9fe94
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
This commit is contained in:
Subbaraman Narayanamurthy 2015-08-25 11:43:32 -07:00 committed by Gerrit - the friendly Code Review server
parent e8d2d9090d
commit 73e82f426b
1 changed files with 1 additions and 1 deletions

View File

@ -7593,7 +7593,7 @@ static int smbchg_probe(struct spmi_device *spmi)
if (rc) {
dev_err(&spmi->dev,
"Couldn't initialize regulator rc=%d\n", rc);
return rc;
goto free_regulator;
}
rc = smbchg_hw_init(chip);