Skip to content

Commit 74b64e7

Browse files
superna9999gregkh
authored andcommitted
usb: typec-mux: nb7vpq904m: unregister typec switch on probe error and remove
Add the missing call to typec_switch_put() when probe fails and the nb7vpq904m_remove() call is called. Fixes: 348359e ("usb: typec: nb7vpq904m: Add an error handling path in nb7vpq904m_probe()") Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org> Fixes: 88d8f3a ("usb: typec: add support for the nb7vpq904m Type-C Linear Redriver") Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Link: https://lore.kernel.org/r/20240606-topic-sm8x50-upstream-retimer-broadcast-mode-v2-2-c6f6eae479c3@linaro.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 2be53b0 commit 74b64e7

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

drivers/usb/typec/mux/nb7vpq904m.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ static int nb7vpq904m_probe(struct i2c_client *client)
415415

416416
ret = nb7vpq904m_parse_data_lanes_mapping(nb7);
417417
if (ret)
418-
return ret;
418+
goto err_switch_put;
419419

420420
ret = regulator_enable(nb7->vcc_supply);
421421
if (ret)
@@ -458,6 +458,9 @@ static int nb7vpq904m_probe(struct i2c_client *client)
458458
gpiod_set_value(nb7->enable_gpio, 0);
459459
regulator_disable(nb7->vcc_supply);
460460

461+
err_switch_put:
462+
typec_switch_put(nb7->typec_switch);
463+
461464
return ret;
462465
}
463466

@@ -471,6 +474,8 @@ static void nb7vpq904m_remove(struct i2c_client *client)
471474
gpiod_set_value(nb7->enable_gpio, 0);
472475

473476
regulator_disable(nb7->vcc_supply);
477+
478+
typec_switch_put(nb7->typec_switch);
474479
}
475480

476481
static const struct i2c_device_id nb7vpq904m_table[] = {

0 commit comments

Comments
 (0)