Add the missing unlock before return from function
dp_altmode_activate() in the error handling case.

Fixes: 0e3bb7d6894d ("usb: typec: Add driver for DisplayPort alternate mode")
Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/usb/typec/altmodes/displayport.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/typec/altmodes/displayport.c 
b/drivers/usb/typec/altmodes/displayport.c
index ef12b15..83e3a38 100644
--- a/drivers/usb/typec/altmodes/displayport.c
+++ b/drivers/usb/typec/altmodes/displayport.c
@@ -349,8 +349,10 @@ static int dp_altmode_activate(struct typec_altmode *alt, 
int activate)
        cap = DP_CAP_CAPABILITY(dp->alt->vdo);
 
        if ((con == DP_CONF_DFP_D && !(cap & DP_CAP_DFP_D)) ||
-           (con == DP_CONF_UFP_D && !(cap & DP_CAP_UFP_D)))
-               return -EINVAL;
+           (con == DP_CONF_UFP_D && !(cap & DP_CAP_UFP_D))) {
+               ret = -EINVAL;
+               goto err_unlock;
+       }
 
        conf = dp->data.conf & ~DP_CONF_DUAL_D;
        conf |= con;

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to