Skip to content

Commit 2be53b0

Browse files
superna9999gregkh
authored andcommitted
usb: typec-mux: ptn36502: unregister typec switch on probe error and remove
Add the missing call to typec_switch_put() when probe fails and the ptn36502_remove() call is called. Fixes: 8e99dc7 ("usb: typec: add support for PTN36502 redriver") Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org> Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Link: https://lore.kernel.org/r/20240606-topic-sm8x50-upstream-retimer-broadcast-mode-v2-1-c6f6eae479c3@linaro.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 2e031f5 commit 2be53b0

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

drivers/usb/typec/mux/ptn36502.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,8 +322,10 @@ static int ptn36502_probe(struct i2c_client *client)
322322
"Failed to acquire orientation-switch\n");
323323

324324
ret = regulator_enable(ptn->vdd18_supply);
325-
if (ret)
326-
return dev_err_probe(dev, ret, "Failed to enable vdd18\n");
325+
if (ret) {
326+
ret = dev_err_probe(dev, ret, "Failed to enable vdd18\n");
327+
goto err_switch_put;
328+
}
327329

328330
ret = ptn36502_detect(ptn);
329331
if (ret)
@@ -363,6 +365,9 @@ static int ptn36502_probe(struct i2c_client *client)
363365
err_disable_regulator:
364366
regulator_disable(ptn->vdd18_supply);
365367

368+
err_switch_put:
369+
typec_switch_put(ptn->typec_switch);
370+
366371
return ret;
367372
}
368373

@@ -374,6 +379,8 @@ static void ptn36502_remove(struct i2c_client *client)
374379
typec_switch_unregister(ptn->sw);
375380

376381
regulator_disable(ptn->vdd18_supply);
382+
383+
typec_switch_put(ptn->typec_switch);
377384
}
378385

379386
static const struct i2c_device_id ptn36502_table[] = {

0 commit comments

Comments
 (0)