* [PATCH] usb: dwc3-meson-g12a: Fix an error handling path in dwc3_meson_g12a_probe()
@ 2023-06-10 13:32 Christophe JAILLET
2023-06-12 10:02 ` Neil Armstrong
2023-06-12 20:24 ` Martin Blumenstingl
0 siblings, 2 replies; 3+ messages in thread
From: Christophe JAILLET @ 2023-06-10 13:32 UTC (permalink / raw)
To: Thinh Nguyen, Greg Kroah-Hartman, Neil Armstrong, Kevin Hilman,
Jerome Brunet, Martin Blumenstingl, Felipe Balbi, Yue Wang,
Hanjie Lin
Cc: linux-kernel, kernel-janitors, Christophe JAILLET, linux-usb,
linux-arm-kernel, linux-amlogic
If dwc3_meson_g12a_otg_init() fails, resources allocated by the previous
of_platform_populate() call should be released, as already done in the
error handling path.
Fixes: 1e355f21d3fb ("usb: dwc3: Add Amlogic A1 DWC3 glue")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
drivers/usb/dwc3/dwc3-meson-g12a.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/dwc3/dwc3-meson-g12a.c b/drivers/usb/dwc3/dwc3-meson-g12a.c
index 365aec00d302..e99c7489dba0 100644
--- a/drivers/usb/dwc3/dwc3-meson-g12a.c
+++ b/drivers/usb/dwc3/dwc3-meson-g12a.c
@@ -796,7 +796,7 @@ static int dwc3_meson_g12a_probe(struct platform_device *pdev)
ret = dwc3_meson_g12a_otg_init(pdev, priv);
if (ret)
- goto err_phys_power;
+ goto err_plat_depopulate;
pm_runtime_set_active(dev);
pm_runtime_enable(dev);
@@ -804,6 +804,9 @@ static int dwc3_meson_g12a_probe(struct platform_device *pdev)
return 0;
+err_plat_depopulate:
+ of_platform_depopulate(dev);
+
err_phys_power:
for (i = 0 ; i < PHY_COUNT ; ++i)
phy_power_off(priv->phys[i]);
--
2.34.1
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] usb: dwc3-meson-g12a: Fix an error handling path in dwc3_meson_g12a_probe()
2023-06-10 13:32 [PATCH] usb: dwc3-meson-g12a: Fix an error handling path in dwc3_meson_g12a_probe() Christophe JAILLET
@ 2023-06-12 10:02 ` Neil Armstrong
2023-06-12 20:24 ` Martin Blumenstingl
1 sibling, 0 replies; 3+ messages in thread
From: Neil Armstrong @ 2023-06-12 10:02 UTC (permalink / raw)
To: Christophe JAILLET, Thinh Nguyen, Greg Kroah-Hartman,
Kevin Hilman, Jerome Brunet, Martin Blumenstingl, Felipe Balbi,
Yue Wang, Hanjie Lin
Cc: linux-kernel, kernel-janitors, linux-usb, linux-arm-kernel,
linux-amlogic
On 10/06/2023 15:32, Christophe JAILLET wrote:
> If dwc3_meson_g12a_otg_init() fails, resources allocated by the previous
> of_platform_populate() call should be released, as already done in the
> error handling path.
>
> Fixes: 1e355f21d3fb ("usb: dwc3: Add Amlogic A1 DWC3 glue")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> drivers/usb/dwc3/dwc3-meson-g12a.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/dwc3/dwc3-meson-g12a.c b/drivers/usb/dwc3/dwc3-meson-g12a.c
> index 365aec00d302..e99c7489dba0 100644
> --- a/drivers/usb/dwc3/dwc3-meson-g12a.c
> +++ b/drivers/usb/dwc3/dwc3-meson-g12a.c
> @@ -796,7 +796,7 @@ static int dwc3_meson_g12a_probe(struct platform_device *pdev)
>
> ret = dwc3_meson_g12a_otg_init(pdev, priv);
> if (ret)
> - goto err_phys_power;
> + goto err_plat_depopulate;
>
> pm_runtime_set_active(dev);
> pm_runtime_enable(dev);
> @@ -804,6 +804,9 @@ static int dwc3_meson_g12a_probe(struct platform_device *pdev)
>
> return 0;
>
> +err_plat_depopulate:
> + of_platform_depopulate(dev);
> +
> err_phys_power:
> for (i = 0 ; i < PHY_COUNT ; ++i)
> phy_power_off(priv->phys[i]);
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] usb: dwc3-meson-g12a: Fix an error handling path in dwc3_meson_g12a_probe()
2023-06-10 13:32 [PATCH] usb: dwc3-meson-g12a: Fix an error handling path in dwc3_meson_g12a_probe() Christophe JAILLET
2023-06-12 10:02 ` Neil Armstrong
@ 2023-06-12 20:24 ` Martin Blumenstingl
1 sibling, 0 replies; 3+ messages in thread
From: Martin Blumenstingl @ 2023-06-12 20:24 UTC (permalink / raw)
To: Christophe JAILLET
Cc: Thinh Nguyen, Greg Kroah-Hartman, Neil Armstrong, Kevin Hilman,
Jerome Brunet, Felipe Balbi, Yue Wang, Hanjie Lin, linux-kernel,
kernel-janitors, linux-usb, linux-arm-kernel, linux-amlogic
On Sat, Jun 10, 2023 at 3:32 PM Christophe JAILLET
<christophe.jaillet@wanadoo.fr> wrote:
>
> If dwc3_meson_g12a_otg_init() fails, resources allocated by the previous
> of_platform_populate() call should be released, as already done in the
> error handling path.
>
> Fixes: 1e355f21d3fb ("usb: dwc3: Add Amlogic A1 DWC3 glue")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
We should move to devm_of_platform_populate() mid term.
That said, this fix is good for now because it's simple and can be backported.
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-06-12 20:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-10 13:32 [PATCH] usb: dwc3-meson-g12a: Fix an error handling path in dwc3_meson_g12a_probe() Christophe JAILLET
2023-06-12 10:02 ` Neil Armstrong
2023-06-12 20:24 ` Martin Blumenstingl
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®