Skip to contentSkip to conversation

usb: typec: ps883x: fix probe error handling

PATCH In review Johan Hovold 2 participants 2 messages Feb 18, 2025 – Feb 26, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: typec: ps883x: fix probe error handling

Fix the probe error handling to avoid unbalanced clock disable or leaving regulators on after probe failure.

Note that the active-low reset pin should also be asserted to avoid leaking current after disabling the regulators.

Fixes 257a087c8b52 ("usb: typec: Add support for Parade PS8830 Type-C Retimer")
Cc Abel Vesa <[email protected]>
---
 drivers/usb/typec/mux/ps883x.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/usb/typec/mux/ps883x.c +3 -2
index 10e407ab6b7f..ef086989231f 100644
@@ -387,10 +387,11 @@ static int ps883x_retimer_probe(struct i2c_client *client)
 
 err_switch_unregister:
 	typec_switch_unregister(retimer->sw);
-err_vregs_disable:
-	ps883x_disable_vregs(retimer);
 err_clk_disable:
 	clk_disable_unprepare(retimer->xo_clk);
+err_vregs_disable:
+	gpiod_set_value(retimer->reset_gpio, 1);
+	ps883x_disable_vregs(retimer);
 err_mux_put:
 	typec_mux_put(retimer->typec_mux);
 err_switch_put:
Signature · 1 line
2.45.3
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Johan Hovold

Fix the probe error handling to avoid unbalanced clock disable or leaving regulators on after probe failure.

Note that the active-low reset pin should also be asserted to avoid leaking current after disabling the regulators.

Fixes 257a087c8b52 ("usb: typec: Add support for Parade PS8830 Type-C Retimer")
Cc Abel Vesa <[email protected]>
Quoted 24 lines
---
 drivers/usb/typec/mux/ps883x.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/usb/typec/mux/ps883x.c +3 -2
index 10e407ab6b7f..ef086989231f 100644
@@ -387,10 +387,11 @@ static int ps883x_retimer_probe(struct i2c_client *client)
 
 err_switch_unregister:
 	typec_switch_unregister(retimer->sw);
-err_vregs_disable:
-	ps883x_disable_vregs(retimer);
 err_clk_disable:
 	clk_disable_unprepare(retimer->xo_clk);
+err_vregs_disable:
+	gpiod_set_value(retimer->reset_gpio, 1);
+	ps883x_disable_vregs(retimer);
 err_mux_put:
 	typec_mux_put(retimer->typec_mux);
 err_switch_put:
Signature · 1 line
2.45.3
Signature · 1 line
heikki