All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: dwc3: meson-g12a: Disable the regulator in the error handling path of the probe
@ 2021-05-21 16:55 ` Christophe JAILLET
  0 siblings, 0 replies; 9+ messages in thread
From: Christophe JAILLET @ 2021-05-21 16:55 UTC (permalink / raw)
  To: balbi, gregkh, narmstrong, khilman, jbrunet, martin.blumenstingl
  Cc: linux-usb, linux-arm-kernel, linux-amlogic, linux-kernel,
	kernel-janitors, Christophe JAILLET

If an error occurs after a successful 'regulator_enable()' call,
'regulator_disable()' must be called.

Fix the error handling path of the probe accordingly.

The remove function doesn't need to be fixed, because the
'regulator_disable()' call is already hidden in 'dwc3_meson_g12a_suspend()'
which is called via 'pm_runtime_set_suspended()' in the remove function.

Fixes: c99993376f72 ("usb: dwc3: Add Amlogic G12A DWC3 glue")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Please review carefully.

I'm not that sure about:
   The remove function doesn't need to be fixed, because the
   'regulator_disable()' call is already hidden in 'dwc3_meson_g12a_suspend()'
   which is called via 'pm_runtime_set_suspended()' in the remove function.

This is more a guess than anything else!
---
 drivers/usb/dwc3/dwc3-meson-g12a.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/dwc3/dwc3-meson-g12a.c b/drivers/usb/dwc3/dwc3-meson-g12a.c
index bdf1f98dfad8..804957525130 100644
--- a/drivers/usb/dwc3/dwc3-meson-g12a.c
+++ b/drivers/usb/dwc3/dwc3-meson-g12a.c
@@ -772,13 +772,13 @@ static int dwc3_meson_g12a_probe(struct platform_device *pdev)
 
 	ret = priv->drvdata->usb_init(priv);
 	if (ret)
-		goto err_disable_clks;
+		goto err_disable_regulator;
 
 	/* Init PHYs */
 	for (i = 0 ; i < PHY_COUNT ; ++i) {
 		ret = phy_init(priv->phys[i]);
 		if (ret)
-			goto err_disable_clks;
+			goto err_disable_regulator;
 	}
 
 	/* Set PHY Power */
@@ -816,6 +816,10 @@ static int dwc3_meson_g12a_probe(struct platform_device *pdev)
 	for (i = 0 ; i < PHY_COUNT ; ++i)
 		phy_exit(priv->phys[i]);
 
+err_disable_regulator:
+	if (priv->vbus)
+		regulator_disable(priv->vbus);
+
 err_disable_clks:
 	clk_bulk_disable_unprepare(priv->drvdata->num_clks,
 				   priv->drvdata->clks);
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH] usb: dwc3: meson-g12a: Disable the regulator in the error handling path of the probe
@ 2021-05-21 16:55 ` Christophe JAILLET
  0 siblings, 0 replies; 9+ messages in thread
From: Christophe JAILLET @ 2021-05-21 16:55 UTC (permalink / raw)
  To: balbi, gregkh, narmstrong, khilman, jbrunet, martin.blumenstingl
  Cc: linux-usb, linux-arm-kernel, linux-amlogic, linux-kernel,
	kernel-janitors, Christophe JAILLET

If an error occurs after a successful 'regulator_enable()' call,
'regulator_disable()' must be called.

Fix the error handling path of the probe accordingly.

The remove function doesn't need to be fixed, because the
'regulator_disable()' call is already hidden in 'dwc3_meson_g12a_suspend()'
which is called via 'pm_runtime_set_suspended()' in the remove function.

Fixes: c99993376f72 ("usb: dwc3: Add Amlogic G12A DWC3 glue")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Please review carefully.

I'm not that sure about:
   The remove function doesn't need to be fixed, because the
   'regulator_disable()' call is already hidden in 'dwc3_meson_g12a_suspend()'
   which is called via 'pm_runtime_set_suspended()' in the remove function.

This is more a guess than anything else!
---
 drivers/usb/dwc3/dwc3-meson-g12a.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/dwc3/dwc3-meson-g12a.c b/drivers/usb/dwc3/dwc3-meson-g12a.c
index bdf1f98dfad8..804957525130 100644
--- a/drivers/usb/dwc3/dwc3-meson-g12a.c
+++ b/drivers/usb/dwc3/dwc3-meson-g12a.c
@@ -772,13 +772,13 @@ static int dwc3_meson_g12a_probe(struct platform_device *pdev)
 
 	ret = priv->drvdata->usb_init(priv);
 	if (ret)
-		goto err_disable_clks;
+		goto err_disable_regulator;
 
 	/* Init PHYs */
 	for (i = 0 ; i < PHY_COUNT ; ++i) {
 		ret = phy_init(priv->phys[i]);
 		if (ret)
-			goto err_disable_clks;
+			goto err_disable_regulator;
 	}
 
 	/* Set PHY Power */
@@ -816,6 +816,10 @@ static int dwc3_meson_g12a_probe(struct platform_device *pdev)
 	for (i = 0 ; i < PHY_COUNT ; ++i)
 		phy_exit(priv->phys[i]);
 
+err_disable_regulator:
+	if (priv->vbus)
+		regulator_disable(priv->vbus);
+
 err_disable_clks:
 	clk_bulk_disable_unprepare(priv->drvdata->num_clks,
 				   priv->drvdata->clks);
-- 
2.30.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH] usb: dwc3: meson-g12a: Disable the regulator in the error handling path of the probe
@ 2021-05-21 16:55 ` Christophe JAILLET
  0 siblings, 0 replies; 9+ messages in thread
From: Christophe JAILLET @ 2021-05-21 16:55 UTC (permalink / raw)
  To: balbi, gregkh, narmstrong, khilman, jbrunet, martin.blumenstingl
  Cc: linux-usb, linux-arm-kernel, linux-amlogic, linux-kernel,
	kernel-janitors, Christophe JAILLET

If an error occurs after a successful 'regulator_enable()' call,
'regulator_disable()' must be called.

Fix the error handling path of the probe accordingly.

The remove function doesn't need to be fixed, because the
'regulator_disable()' call is already hidden in 'dwc3_meson_g12a_suspend()'
which is called via 'pm_runtime_set_suspended()' in the remove function.

Fixes: c99993376f72 ("usb: dwc3: Add Amlogic G12A DWC3 glue")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Please review carefully.

I'm not that sure about:
   The remove function doesn't need to be fixed, because the
   'regulator_disable()' call is already hidden in 'dwc3_meson_g12a_suspend()'
   which is called via 'pm_runtime_set_suspended()' in the remove function.

This is more a guess than anything else!
---
 drivers/usb/dwc3/dwc3-meson-g12a.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/dwc3/dwc3-meson-g12a.c b/drivers/usb/dwc3/dwc3-meson-g12a.c
index bdf1f98dfad8..804957525130 100644
--- a/drivers/usb/dwc3/dwc3-meson-g12a.c
+++ b/drivers/usb/dwc3/dwc3-meson-g12a.c
@@ -772,13 +772,13 @@ static int dwc3_meson_g12a_probe(struct platform_device *pdev)
 
 	ret = priv->drvdata->usb_init(priv);
 	if (ret)
-		goto err_disable_clks;
+		goto err_disable_regulator;
 
 	/* Init PHYs */
 	for (i = 0 ; i < PHY_COUNT ; ++i) {
 		ret = phy_init(priv->phys[i]);
 		if (ret)
-			goto err_disable_clks;
+			goto err_disable_regulator;
 	}
 
 	/* Set PHY Power */
@@ -816,6 +816,10 @@ static int dwc3_meson_g12a_probe(struct platform_device *pdev)
 	for (i = 0 ; i < PHY_COUNT ; ++i)
 		phy_exit(priv->phys[i]);
 
+err_disable_regulator:
+	if (priv->vbus)
+		regulator_disable(priv->vbus);
+
 err_disable_clks:
 	clk_bulk_disable_unprepare(priv->drvdata->num_clks,
 				   priv->drvdata->clks);
-- 
2.30.2


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH] usb: dwc3: meson-g12a: Disable the regulator in the error handling path of the probe
  2021-05-21 16:55 ` Christophe JAILLET
  (?)
@ 2021-05-23 16:03   ` Martin Blumenstingl
  -1 siblings, 0 replies; 9+ messages in thread
From: Martin Blumenstingl @ 2021-05-23 16:03 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: balbi, gregkh, Neil Armstrong, khilman, jbrunet, linux-usb,
	linux-arm-kernel, linux-amlogic, linux-kernel, kernel-janitors

Hi Christophe,

On Fri, May 21, 2021 at 6:55 PM Christophe JAILLET
<christophe.jaillet@wanadoo.fr> wrote:
>
> If an error occurs after a successful 'regulator_enable()' call,
> 'regulator_disable()' must be called.
>
> Fix the error handling path of the probe accordingly.
>
> The remove function doesn't need to be fixed, because the
> 'regulator_disable()' call is already hidden in 'dwc3_meson_g12a_suspend()'
> which is called via 'pm_runtime_set_suspended()' in the remove function.
>
> Fixes: c99993376f72 ("usb: dwc3: Add Amlogic G12A DWC3 glue")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
for me this makes sense so:
Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>

> ---
> Please review carefully.
>
> I'm not that sure about:
>    The remove function doesn't need to be fixed, because the
>    'regulator_disable()' call is already hidden in 'dwc3_meson_g12a_suspend()'
>    which is called via 'pm_runtime_set_suspended()' in the remove function.
>
> This is more a guess than anything else!
I am not 100% sure about the suspend code-path, so I am hoping that
someone else (for example Neil) can also review your patch


Best regards,
Martin

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] usb: dwc3: meson-g12a: Disable the regulator in the error handling path of the probe
@ 2021-05-23 16:03   ` Martin Blumenstingl
  0 siblings, 0 replies; 9+ messages in thread
From: Martin Blumenstingl @ 2021-05-23 16:03 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: balbi, gregkh, Neil Armstrong, khilman, jbrunet, linux-usb,
	linux-arm-kernel, linux-amlogic, linux-kernel, kernel-janitors

Hi Christophe,

On Fri, May 21, 2021 at 6:55 PM Christophe JAILLET
<christophe.jaillet@wanadoo.fr> wrote:
>
> If an error occurs after a successful 'regulator_enable()' call,
> 'regulator_disable()' must be called.
>
> Fix the error handling path of the probe accordingly.
>
> The remove function doesn't need to be fixed, because the
> 'regulator_disable()' call is already hidden in 'dwc3_meson_g12a_suspend()'
> which is called via 'pm_runtime_set_suspended()' in the remove function.
>
> Fixes: c99993376f72 ("usb: dwc3: Add Amlogic G12A DWC3 glue")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
for me this makes sense so:
Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>

> ---
> Please review carefully.
>
> I'm not that sure about:
>    The remove function doesn't need to be fixed, because the
>    'regulator_disable()' call is already hidden in 'dwc3_meson_g12a_suspend()'
>    which is called via 'pm_runtime_set_suspended()' in the remove function.
>
> This is more a guess than anything else!
I am not 100% sure about the suspend code-path, so I am hoping that
someone else (for example Neil) can also review your patch


Best regards,
Martin

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] usb: dwc3: meson-g12a: Disable the regulator in the error handling path of the probe
@ 2021-05-23 16:03   ` Martin Blumenstingl
  0 siblings, 0 replies; 9+ messages in thread
From: Martin Blumenstingl @ 2021-05-23 16:03 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: balbi, gregkh, Neil Armstrong, khilman, jbrunet, linux-usb,
	linux-arm-kernel, linux-amlogic, linux-kernel, kernel-janitors

Hi Christophe,

On Fri, May 21, 2021 at 6:55 PM Christophe JAILLET
<christophe.jaillet@wanadoo.fr> wrote:
>
> If an error occurs after a successful 'regulator_enable()' call,
> 'regulator_disable()' must be called.
>
> Fix the error handling path of the probe accordingly.
>
> The remove function doesn't need to be fixed, because the
> 'regulator_disable()' call is already hidden in 'dwc3_meson_g12a_suspend()'
> which is called via 'pm_runtime_set_suspended()' in the remove function.
>
> Fixes: c99993376f72 ("usb: dwc3: Add Amlogic G12A DWC3 glue")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
for me this makes sense so:
Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>

> ---
> Please review carefully.
>
> I'm not that sure about:
>    The remove function doesn't need to be fixed, because the
>    'regulator_disable()' call is already hidden in 'dwc3_meson_g12a_suspend()'
>    which is called via 'pm_runtime_set_suspended()' in the remove function.
>
> This is more a guess than anything else!
I am not 100% sure about the suspend code-path, so I am hoping that
someone else (for example Neil) can also review your patch


Best regards,
Martin

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] usb: dwc3: meson-g12a: Disable the regulator in the error handling path of the probe
  2021-05-23 16:03   ` Martin Blumenstingl
  (?)
@ 2021-06-01  8:47     ` Neil Armstrong
  -1 siblings, 0 replies; 9+ messages in thread
From: Neil Armstrong @ 2021-06-01  8:47 UTC (permalink / raw)
  To: Martin Blumenstingl, Christophe JAILLET
  Cc: balbi, gregkh, khilman, jbrunet, linux-usb, linux-arm-kernel,
	linux-amlogic, linux-kernel, kernel-janitors

On 23/05/2021 18:03, Martin Blumenstingl wrote:
> Hi Christophe,
> 
> On Fri, May 21, 2021 at 6:55 PM Christophe JAILLET
> <christophe.jaillet@wanadoo.fr> wrote:
>>
>> If an error occurs after a successful 'regulator_enable()' call,
>> 'regulator_disable()' must be called.
>>
>> Fix the error handling path of the probe accordingly.
>>
>> The remove function doesn't need to be fixed, because the
>> 'regulator_disable()' call is already hidden in 'dwc3_meson_g12a_suspend()'
>> which is called via 'pm_runtime_set_suspended()' in the remove function.
>>
>> Fixes: c99993376f72 ("usb: dwc3: Add Amlogic G12A DWC3 glue")
>> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> for me this makes sense so:
> Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>

Acked-by: Neil Armstrong <narmstrong@baylibre.com>

> 
>> ---
>> Please review carefully.
>>
>> I'm not that sure about:
>>    The remove function doesn't need to be fixed, because the
>>    'regulator_disable()' call is already hidden in 'dwc3_meson_g12a_suspend()'
>>    which is called via 'pm_runtime_set_suspended()' in the remove function.
>>
>> This is more a guess than anything else!
> I am not 100% sure about the suspend code-path, so I am hoping that
> someone else (for example Neil) can also review your patch

Not 100% sure aswell, but the probe function is wrong anyway and must be fixed by this patch, so LGTM.

Neil

> 
> 
> Best regards,
> Martin
> 


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] usb: dwc3: meson-g12a: Disable the regulator in the error handling path of the probe
@ 2021-06-01  8:47     ` Neil Armstrong
  0 siblings, 0 replies; 9+ messages in thread
From: Neil Armstrong @ 2021-06-01  8:47 UTC (permalink / raw)
  To: Martin Blumenstingl, Christophe JAILLET
  Cc: balbi, gregkh, khilman, jbrunet, linux-usb, linux-arm-kernel,
	linux-amlogic, linux-kernel, kernel-janitors

On 23/05/2021 18:03, Martin Blumenstingl wrote:
> Hi Christophe,
> 
> On Fri, May 21, 2021 at 6:55 PM Christophe JAILLET
> <christophe.jaillet@wanadoo.fr> wrote:
>>
>> If an error occurs after a successful 'regulator_enable()' call,
>> 'regulator_disable()' must be called.
>>
>> Fix the error handling path of the probe accordingly.
>>
>> The remove function doesn't need to be fixed, because the
>> 'regulator_disable()' call is already hidden in 'dwc3_meson_g12a_suspend()'
>> which is called via 'pm_runtime_set_suspended()' in the remove function.
>>
>> Fixes: c99993376f72 ("usb: dwc3: Add Amlogic G12A DWC3 glue")
>> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> for me this makes sense so:
> Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>

Acked-by: Neil Armstrong <narmstrong@baylibre.com>

> 
>> ---
>> Please review carefully.
>>
>> I'm not that sure about:
>>    The remove function doesn't need to be fixed, because the
>>    'regulator_disable()' call is already hidden in 'dwc3_meson_g12a_suspend()'
>>    which is called via 'pm_runtime_set_suspended()' in the remove function.
>>
>> This is more a guess than anything else!
> I am not 100% sure about the suspend code-path, so I am hoping that
> someone else (for example Neil) can also review your patch

Not 100% sure aswell, but the probe function is wrong anyway and must be fixed by this patch, so LGTM.

Neil

> 
> 
> Best regards,
> Martin
> 


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] usb: dwc3: meson-g12a: Disable the regulator in the error handling path of the probe
@ 2021-06-01  8:47     ` Neil Armstrong
  0 siblings, 0 replies; 9+ messages in thread
From: Neil Armstrong @ 2021-06-01  8:47 UTC (permalink / raw)
  To: Martin Blumenstingl, Christophe JAILLET
  Cc: balbi, gregkh, khilman, jbrunet, linux-usb, linux-arm-kernel,
	linux-amlogic, linux-kernel, kernel-janitors

On 23/05/2021 18:03, Martin Blumenstingl wrote:
> Hi Christophe,
> 
> On Fri, May 21, 2021 at 6:55 PM Christophe JAILLET
> <christophe.jaillet@wanadoo.fr> wrote:
>>
>> If an error occurs after a successful 'regulator_enable()' call,
>> 'regulator_disable()' must be called.
>>
>> Fix the error handling path of the probe accordingly.
>>
>> The remove function doesn't need to be fixed, because the
>> 'regulator_disable()' call is already hidden in 'dwc3_meson_g12a_suspend()'
>> which is called via 'pm_runtime_set_suspended()' in the remove function.
>>
>> Fixes: c99993376f72 ("usb: dwc3: Add Amlogic G12A DWC3 glue")
>> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> for me this makes sense so:
> Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>

Acked-by: Neil Armstrong <narmstrong@baylibre.com>

> 
>> ---
>> Please review carefully.
>>
>> I'm not that sure about:
>>    The remove function doesn't need to be fixed, because the
>>    'regulator_disable()' call is already hidden in 'dwc3_meson_g12a_suspend()'
>>    which is called via 'pm_runtime_set_suspended()' in the remove function.
>>
>> This is more a guess than anything else!
> I am not 100% sure about the suspend code-path, so I am hoping that
> someone else (for example Neil) can also review your patch

Not 100% sure aswell, but the probe function is wrong anyway and must be fixed by this patch, so LGTM.

Neil

> 
> 
> Best regards,
> Martin
> 


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-06-01  8:50 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-21 16:55 [PATCH] usb: dwc3: meson-g12a: Disable the regulator in the error handling path of the probe Christophe JAILLET
2021-05-21 16:55 ` Christophe JAILLET
2021-05-21 16:55 ` Christophe JAILLET
2021-05-23 16:03 ` Martin Blumenstingl
2021-05-23 16:03   ` Martin Blumenstingl
2021-05-23 16:03   ` Martin Blumenstingl
2021-06-01  8:47   ` Neil Armstrong
2021-06-01  8:47     ` Neil Armstrong
2021-06-01  8:47     ` Neil Armstrong

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.