diff mbox series

usb: phy: tahvo: release resources on error in probe()

Message ID 80496b6d-990e-4fb3-808b-daf3143cef15@kili.mountain (mailing list archive)
State Accepted
Commit 342161c11403ea00e9febc16baab1d883d589d04
Headers show
Series usb: phy: tahvo: release resources on error in probe() | expand

Commit Message

Dan Carpenter May 25, 2023, 8:05 a.m. UTC
We need to do some clean up before returning on this error path.

Fixes: 0d45a1373e66 ("usb: phy: tahvo: add IRQ check")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 drivers/usb/phy/phy-tahvo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Dongliang Mu May 25, 2023, 12:22 p.m. UTC | #1
On Thu, May 25, 2023 at 4:12 PM Dan Carpenter <dan.carpenter@linaro.org> wrote:
>
> We need to do some clean up before returning on this error path.
>
> Fixes: 0d45a1373e66 ("usb: phy: tahvo: add IRQ check")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>

Hi Dan,

it seems this patch is already submitted with Yang Li from our mailing
list. Please refer to:

https://www.spinics.net/lists/linux-usb/msg240531.html

> ---
>  drivers/usb/phy/phy-tahvo.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/usb/phy/phy-tahvo.c b/drivers/usb/phy/phy-tahvo.c
> index 47562d49dfc1..5cac31c6029b 100644
> --- a/drivers/usb/phy/phy-tahvo.c
> +++ b/drivers/usb/phy/phy-tahvo.c
> @@ -391,7 +391,7 @@ static int tahvo_usb_probe(struct platform_device *pdev)
>
>         tu->irq = ret = platform_get_irq(pdev, 0);
>         if (ret < 0)
> -               return ret;
> +               goto err_remove_phy;
>         ret = request_threaded_irq(tu->irq, NULL, tahvo_usb_vbus_interrupt,
>                                    IRQF_ONESHOT,
>                                    "tahvo-vbus", tu);
> --
> 2.39.2
>
Dan Carpenter May 25, 2023, 12:49 p.m. UTC | #2
On Thu, May 25, 2023 at 08:22:15PM +0800, Dongliang Mu wrote:
> On Thu, May 25, 2023 at 4:12 PM Dan Carpenter <dan.carpenter@linaro.org> wrote:
> >
> > We need to do some clean up before returning on this error path.
> >
> > Fixes: 0d45a1373e66 ("usb: phy: tahvo: add IRQ check")
> > Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> 
> Hi Dan,
> 
> it seems this patch is already submitted with Yang Li from our mailing
> list. Please refer to:
> 
> https://www.spinics.net/lists/linux-usb/msg240531.html
> 

Ah, fine.  Patches are normally applied on a first come first serve
basis so Yang Li's patch will be applied instead of mine.

I sent my patch based on a different static checker warning that I'm
working on about use after frees.  Where we add dev_ data to a list but
don't remove it on the error path.

drivers/usb/phy/phy-tahvo.c:394 tahvo_usb_probe() warn: devm_ variable is still on list 'tu' (see line 360)

regards,
dan carpenter
diff mbox series

Patch

diff --git a/drivers/usb/phy/phy-tahvo.c b/drivers/usb/phy/phy-tahvo.c
index 47562d49dfc1..5cac31c6029b 100644
--- a/drivers/usb/phy/phy-tahvo.c
+++ b/drivers/usb/phy/phy-tahvo.c
@@ -391,7 +391,7 @@  static int tahvo_usb_probe(struct platform_device *pdev)
 
 	tu->irq = ret = platform_get_irq(pdev, 0);
 	if (ret < 0)
-		return ret;
+		goto err_remove_phy;
 	ret = request_threaded_irq(tu->irq, NULL, tahvo_usb_vbus_interrupt,
 				   IRQF_ONESHOT,
 				   "tahvo-vbus", tu);