diff mbox series

[v2,2/4] usb: typec-mux: nb7vpq904m: unregister typec switch on probe error and remove

Message ID 20240606-topic-sm8x50-upstream-retimer-broadcast-mode-v2-2-c6f6eae479c3@linaro.org
State New
Headers show
Series usb: typec-mux: broadcast typec state to next mux for ptn36502 & nb7vpq904m retimers | expand

Commit Message

Neil Armstrong June 6, 2024, 1:11 p.m. UTC
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>
---
 drivers/usb/typec/mux/nb7vpq904m.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Dmitry Baryshkov June 7, 2024, 5:50 a.m. UTC | #1
On Thu, Jun 06, 2024 at 03:11:14PM +0200, Neil Armstrong wrote:
> 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>
> ---
>  drivers/usb/typec/mux/nb7vpq904m.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)

I'd say:

Fixes: 88d8f3ac9c67 ("usb: typec: add support for the nb7vpq904m Type-C Linear Redriver")

Nevertheless:

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Neil Armstrong June 7, 2024, 2 p.m. UTC | #2
On 07/06/2024 07:50, Dmitry Baryshkov wrote:
> On Thu, Jun 06, 2024 at 03:11:14PM +0200, Neil Armstrong wrote:
>> 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>
>> ---
>>   drivers/usb/typec/mux/nb7vpq904m.c | 7 ++++++-
>>   1 file changed, 6 insertions(+), 1 deletion(-)
> 
> I'd say:
> 
> Fixes: 88d8f3ac9c67 ("usb: typec: add support for the nb7vpq904m Type-C Linear Redriver")

I should add both yes, it won't apply with only 88d8f3ac9c67

> 
> Nevertheless:
> 
> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> 
> 
>
Dmitry Baryshkov June 7, 2024, 2:49 p.m. UTC | #3
On Fri, Jun 07, 2024 at 04:00:22PM +0200, Neil Armstrong wrote:
> On 07/06/2024 07:50, Dmitry Baryshkov wrote:
> > On Thu, Jun 06, 2024 at 03:11:14PM +0200, Neil Armstrong wrote:
> > > 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>
> > > ---
> > >   drivers/usb/typec/mux/nb7vpq904m.c | 7 ++++++-
> > >   1 file changed, 6 insertions(+), 1 deletion(-)
> > 
> > I'd say:
> > 
> > Fixes: 88d8f3ac9c67 ("usb: typec: add support for the nb7vpq904m Type-C Linear Redriver")
> 
> I should add both yes, it won't apply with only 88d8f3ac9c67

That's fine. The issue is still present in the original commit. In the
worst case you'll get a 'please backport' request.

> 
> > 
> > Nevertheless:
> > 
> > Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> > 
> > 
> > 
>
Heikki Krogerus June 10, 2024, 1:02 p.m. UTC | #4
On Thu, Jun 06, 2024 at 03:11:14PM +0200, Neil Armstrong wrote:
> 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>

Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>

> ---
>  drivers/usb/typec/mux/nb7vpq904m.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/typec/mux/nb7vpq904m.c b/drivers/usb/typec/mux/nb7vpq904m.c
> index ed93194b16cf..569f1162ee2e 100644
> --- a/drivers/usb/typec/mux/nb7vpq904m.c
> +++ b/drivers/usb/typec/mux/nb7vpq904m.c
> @@ -415,7 +415,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)
> @@ -458,6 +458,9 @@ static int nb7vpq904m_probe(struct i2c_client *client)
>  	gpiod_set_value(nb7->enable_gpio, 0);
>  	regulator_disable(nb7->vcc_supply);
>  
> +err_switch_put:
> +	typec_switch_put(nb7->typec_switch);
> +
>  	return ret;
>  }
>  
> @@ -471,6 +474,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[] = {
> 
> -- 
> 2.34.1
diff mbox series

Patch

diff --git a/drivers/usb/typec/mux/nb7vpq904m.c b/drivers/usb/typec/mux/nb7vpq904m.c
index ed93194b16cf..569f1162ee2e 100644
--- a/drivers/usb/typec/mux/nb7vpq904m.c
+++ b/drivers/usb/typec/mux/nb7vpq904m.c
@@ -415,7 +415,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)
@@ -458,6 +458,9 @@  static int nb7vpq904m_probe(struct i2c_client *client)
 	gpiod_set_value(nb7->enable_gpio, 0);
 	regulator_disable(nb7->vcc_supply);
 
+err_switch_put:
+	typec_switch_put(nb7->typec_switch);
+
 	return ret;
 }
 
@@ -471,6 +474,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[] = {