Commit 2be53b04 authored by Neil Armstrong's avatar Neil Armstrong Committed by Greg Kroah-Hartman

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: 8e99dc78 ("usb: typec: add support for PTN36502 redriver")
Signed-off-by: default avatarNeil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: default avatarHeikki Krogerus <heikki.krogerus@linux.intel.com>
Reviewed-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Link: https://lore.kernel.org/r/20240606-topic-sm8x50-upstream-retimer-broadcast-mode-v2-1-c6f6eae479c3@linaro.orgSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 2e031f50
...@@ -322,8 +322,10 @@ static int ptn36502_probe(struct i2c_client *client) ...@@ -322,8 +322,10 @@ static int ptn36502_probe(struct i2c_client *client)
"Failed to acquire orientation-switch\n"); "Failed to acquire orientation-switch\n");
ret = regulator_enable(ptn->vdd18_supply); ret = regulator_enable(ptn->vdd18_supply);
if (ret) if (ret) {
return dev_err_probe(dev, ret, "Failed to enable vdd18\n"); ret = dev_err_probe(dev, ret, "Failed to enable vdd18\n");
goto err_switch_put;
}
ret = ptn36502_detect(ptn); ret = ptn36502_detect(ptn);
if (ret) if (ret)
...@@ -363,6 +365,9 @@ static int ptn36502_probe(struct i2c_client *client) ...@@ -363,6 +365,9 @@ static int ptn36502_probe(struct i2c_client *client)
err_disable_regulator: err_disable_regulator:
regulator_disable(ptn->vdd18_supply); regulator_disable(ptn->vdd18_supply);
err_switch_put:
typec_switch_put(ptn->typec_switch);
return ret; return ret;
} }
...@@ -374,6 +379,8 @@ static void ptn36502_remove(struct i2c_client *client) ...@@ -374,6 +379,8 @@ static void ptn36502_remove(struct i2c_client *client)
typec_switch_unregister(ptn->sw); typec_switch_unregister(ptn->sw);
regulator_disable(ptn->vdd18_supply); regulator_disable(ptn->vdd18_supply);
typec_switch_put(ptn->typec_switch);
} }
static const struct i2c_device_id ptn36502_table[] = { static const struct i2c_device_id ptn36502_table[] = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment