platform/chrome: cros_ec_typec: Cleanup switch handle return paths
authorPrashant Malani <pmalani@chromium.org>
Tue, 16 Aug 2022 21:48:34 +0000 (21:48 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 31 Dec 2022 12:14:05 +0000 (13:14 +0100)
[ Upstream commit 66fe238a9bcc158f75ddecf976d1ce7efe20f713 ]

Some of the return paths for the cros_typec_get_switch_handles()
aren't necessary. Clean up the return paths to only undo the handle
get's which succeeded.

Signed-off-by: Prashant Malani <pmalani@chromium.org>
Link: https://lore.kernel.org/r/20220711072333.2064341-9-pmalani@chromium.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Stable-dep-of: 9a8aadcf0b45 ("platform/chrome: cros_ec_typec: zero out stale pointers")
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/platform/chrome/cros_ec_typec.c

index aadb8d2..d63be2b 100644 (file)
@@ -156,12 +156,10 @@ static int cros_typec_get_switch_handles(struct cros_typec_port *port,
        return 0;
 
 role_sw_err:
-       usb_role_switch_put(port->role_sw);
-ori_sw_err:
        typec_switch_put(port->ori_sw);
-mux_err:
+ori_sw_err:
        typec_mux_put(port->mux);
-
+mux_err:
        return -ENODEV;
 }