* [PATCH] phy: renesas: rcar-gen3-usb2: Fix an error handling path in rcar_gen3_phy_usb2_probe()
@ 2024-09-06 19:57 Christophe JAILLET
2024-09-07 10:54 ` claudiu beznea
0 siblings, 1 reply; 2+ messages in thread
From: Christophe JAILLET @ 2024-09-06 19:57 UTC (permalink / raw)
To: Yoshihiro Shimoda, Vinod Koul, Kishon Vijay Abraham I,
Philipp Zabel, Claudiu Beznea
Cc: linux-kernel, kernel-janitors, Christophe JAILLET,
linux-renesas-soc, linux-phy
If an error occurs after the rcar_gen3_phy_usb2_init_bus(),
reset_control_assert() must be called, as already done in the remove
function.
Fixes: 4eae16375357 ("phy: renesas: rcar-gen3-usb2: Add support to initialize the bus")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
drivers/phy/renesas/phy-rcar-gen3-usb2.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/phy/renesas/phy-rcar-gen3-usb2.c b/drivers/phy/renesas/phy-rcar-gen3-usb2.c
index 58e123305152..8577056491de 100644
--- a/drivers/phy/renesas/phy-rcar-gen3-usb2.c
+++ b/drivers/phy/renesas/phy-rcar-gen3-usb2.c
@@ -770,7 +770,7 @@ static int rcar_gen3_phy_usb2_probe(struct platform_device *pdev)
if (IS_ERR(channel->rphys[i].phy)) {
dev_err(dev, "Failed to create USB2 PHY\n");
ret = PTR_ERR(channel->rphys[i].phy);
- goto error;
+ goto err_control_assert;
}
channel->rphys[i].ch = channel;
channel->rphys[i].int_enable_bits = rcar_gen3_int_enable[i];
@@ -784,7 +784,7 @@ static int rcar_gen3_phy_usb2_probe(struct platform_device *pdev)
if (IS_ERR(channel->vbus)) {
if (PTR_ERR(channel->vbus) == -EPROBE_DEFER) {
ret = PTR_ERR(channel->vbus);
- goto error;
+ goto err_control_assert;
}
channel->vbus = NULL;
}
@@ -793,15 +793,17 @@ static int rcar_gen3_phy_usb2_probe(struct platform_device *pdev)
if (IS_ERR(provider)) {
dev_err(dev, "Failed to register PHY provider\n");
ret = PTR_ERR(provider);
- goto error;
+ goto err_control_assert;
} else if (channel->is_otg_channel) {
ret = device_create_file(dev, &dev_attr_role);
if (ret < 0)
- goto error;
+ goto err_control_assert;
}
return 0;
+err_control_assert:
+ reset_control_assert(channel->rstc);
error:
pm_runtime_disable(dev);
--
2.46.0
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] phy: renesas: rcar-gen3-usb2: Fix an error handling path in rcar_gen3_phy_usb2_probe()
2024-09-06 19:57 [PATCH] phy: renesas: rcar-gen3-usb2: Fix an error handling path in rcar_gen3_phy_usb2_probe() Christophe JAILLET
@ 2024-09-07 10:54 ` claudiu beznea
0 siblings, 0 replies; 2+ messages in thread
From: claudiu beznea @ 2024-09-07 10:54 UTC (permalink / raw)
To: Christophe JAILLET, Yoshihiro Shimoda, Vinod Koul,
Kishon Vijay Abraham I, Philipp Zabel, Claudiu Beznea
Cc: linux-kernel, kernel-janitors, linux-renesas-soc, linux-phy
Hi, Christophe,
On 06.09.2024 22:57, Christophe JAILLET wrote:
> If an error occurs after the rcar_gen3_phy_usb2_init_bus(),
> reset_control_assert() must be called, as already done in the remove
> function.
>
> Fixes: 4eae16375357 ("phy: renesas: rcar-gen3-usb2: Add support to initialize the bus")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> drivers/phy/renesas/phy-rcar-gen3-usb2.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/phy/renesas/phy-rcar-gen3-usb2.c b/drivers/phy/renesas/phy-rcar-gen3-usb2.c
> index 58e123305152..8577056491de 100644
> --- a/drivers/phy/renesas/phy-rcar-gen3-usb2.c
> +++ b/drivers/phy/renesas/phy-rcar-gen3-usb2.c
> @@ -770,7 +770,7 @@ static int rcar_gen3_phy_usb2_probe(struct platform_device *pdev)
> if (IS_ERR(channel->rphys[i].phy)) {
> dev_err(dev, "Failed to create USB2 PHY\n");
> ret = PTR_ERR(channel->rphys[i].phy);
> - goto error;
> + goto err_control_assert;
> }
> channel->rphys[i].ch = channel;
> channel->rphys[i].int_enable_bits = rcar_gen3_int_enable[i];
> @@ -784,7 +784,7 @@ static int rcar_gen3_phy_usb2_probe(struct platform_device *pdev)
> if (IS_ERR(channel->vbus)) {
> if (PTR_ERR(channel->vbus) == -EPROBE_DEFER) {
> ret = PTR_ERR(channel->vbus);
> - goto error;
> + goto err_control_assert;
> }
> channel->vbus = NULL;
> }
> @@ -793,15 +793,17 @@ static int rcar_gen3_phy_usb2_probe(struct platform_device *pdev)
> if (IS_ERR(provider)) {
> dev_err(dev, "Failed to register PHY provider\n");
> ret = PTR_ERR(provider);
> - goto error;
> + goto err_control_assert;
> } else if (channel->is_otg_channel) {
> ret = device_create_file(dev, &dev_attr_role);
> if (ret < 0)
> - goto error;
> + goto err_control_assert;
> }
>
> return 0;
>
> +err_control_assert:
> + reset_control_assert(channel->rstc);
> error:
It would be simpler to fix it by calling here:
reset_control_assert(channel->rstc);
as it's the case for rcar_gen3_phy_usb2_remove().
Thank you,
Claudiu Beznea
> pm_runtime_disable(dev);
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-09-07 10:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-09-06 19:57 [PATCH] phy: renesas: rcar-gen3-usb2: Fix an error handling path in rcar_gen3_phy_usb2_probe() Christophe JAILLET
2024-09-07 10:54 ` claudiu beznea
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®