OSDN Git Service

smb-lib: fix Type-C detection after sink removal
authorNicholas Troast <ntroast@codeaurora.org>
Fri, 20 Jan 2017 21:52:10 +0000 (13:52 -0800)
committerNicholas Troast <ntroast@codeaurora.org>
Fri, 20 Jan 2017 21:52:10 +0000 (13:52 -0800)
A misplaced return statement causes an early return from disabling OTG.

If OTG is enabled when a source is attached then Type-C detection will
fail. Therefore, OTG should never be blocked from being disabled.

Remove all of the early returns that could potentially block the
register write which disables OTG.

Change-Id: I4645210233c7490cf3e1b8f6a629fec60399b250
Signed-off-by: Nicholas Troast <ntroast@codeaurora.org>
drivers/power/supply/qcom/smb-lib.c

index d3f7e43..62d8ae0 100644 (file)
@@ -1216,11 +1216,9 @@ static int _smblib_vbus_regulator_disable(struct regulator_dev *rdev)
 
        if (!chg->external_vconn) {
                rc = smblib_read(chg, RID_CC_CONTROL_7_0_REG, &stat);
-               if (rc < 0) {
+               if (rc < 0)
                        smblib_err(chg, "Couldn't read RID_CC_CONTROL_7_0 rc=%d\n",
                                   rc);
-                       return rc;
-               }
 
                /* check if VCONN is enabled on either CC pin */
                if (stat & VCONN_EN_CC_MASK) {
@@ -1229,7 +1227,6 @@ static int _smblib_vbus_regulator_disable(struct regulator_dev *rdev)
                        if (rc < 0)
                                smblib_err(chg, "Couldn't disable VCONN rc=%d\n",
                                           rc);
-                       return rc;
                }
        }