]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
usb: typec-mux: nb7vpq904m: unregister typec switch on probe error and remove
authorNeil Armstrong <neil.armstrong@linaro.org>
Thu, 6 Jun 2024 13:11:14 +0000 (15:11 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 3 Aug 2024 07:00:09 +0000 (09:00 +0200)
[ Upstream commit 74b64e760ee3433c0f8d95715038c869bcddacf7 ]

Add the missing call to typec_switch_put() when probe fails and
the nb7vpq904m_remove() call is called.

Fixes: 348359e7c232 ("usb: typec: nb7vpq904m: Add an error handling path in nb7vpq904m_probe()")
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
Fixes: 88d8f3ac9c67 ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/usb/typec/mux/nb7vpq904m.c

index b17826713753a62496d4af1507281b609b0ec0da..9fe4ce6f62ac084127115798dbfb2f3e65d67f75 100644 (file)
@@ -413,7 +413,7 @@ static int nb7vpq904m_probe(struct i2c_client *client)
 
        ret = nb7vpq904m_parse_data_lanes_mapping(nb7);
        if (ret)
-               return ret;
+               goto err_switch_put;
 
        ret = regulator_enable(nb7->vcc_supply);
        if (ret)
@@ -456,6 +456,9 @@ err_disable_gpio:
        gpiod_set_value(nb7->enable_gpio, 0);
        regulator_disable(nb7->vcc_supply);
 
+err_switch_put:
+       typec_switch_put(nb7->typec_switch);
+
        return ret;
 }
 
@@ -469,6 +472,8 @@ static void nb7vpq904m_remove(struct i2c_client *client)
        gpiod_set_value(nb7->enable_gpio, 0);
 
        regulator_disable(nb7->vcc_supply);
+
+       typec_switch_put(nb7->typec_switch);
 }
 
 static const struct i2c_device_id nb7vpq904m_table[] = {