Re: Re: [PATCH] usb: phy: phy-tahvo: fix memory leak in tahvo_usb_probe()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





> -----Original Messages-----
> From: "Greg Kroah-Hartman" <gregkh@xxxxxxxxxxxxxxxxxxx>
> Sent Time: 2023-04-18 17:19:12 (Tuesday)
> To: "Li Yang" <lidaxian@xxxxxxxxxxx>
> Cc: "Felipe Balbi" <balbi@xxxxxxxxxx>, "Sergey Shtylyov" <s.shtylyov@xxxxxx>, "Dongliang Mu" <dzm91@xxxxxxxxxxx>, linux-usb@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx
> Subject: Re: [PATCH] usb: phy: phy-tahvo: fix memory leak in tahvo_usb_probe()
> 
> On Tue, Apr 18, 2023 at 05:07:57PM +0800, Li Yang wrote:
> > Smatch reports:
> > drivers/usb/phy/phy-tahvo.c: tahvo_usb_probe()
> > warn: missing unwind goto?
> > 
> > After geting irq, if ret < 0, it will return without error handling to
> > free memory.
> > Just add error handling to fix this problem.
> > 
> > Fixes: 0d45a1373e66 ("usb: phy: tahvo: add IRQ check")
> > Signed-off-by: Li Yang <lidaxian@xxxxxxxxxxx>
> > Reviewed-by: Dongliang Mu <dzm91@xxxxxxxxxxx>
> > ---
> > The issue is found by static analysis, and the patch remains untest.
> > ---
> >  drivers/usb/phy/phy-tahvo.c | 7 +++++--
> >  1 file changed, 5 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/usb/phy/phy-tahvo.c b/drivers/usb/phy/phy-tahvo.c
> > index f2d2cc586c5b..184a5f3d7473 100644
> > --- a/drivers/usb/phy/phy-tahvo.c
> > +++ b/drivers/usb/phy/phy-tahvo.c
> > @@ -390,8 +390,11 @@ static int tahvo_usb_probe(struct platform_device *pdev)
> >  	dev_set_drvdata(&pdev->dev, tu);
> >  
> >  	tu->irq = ret = platform_get_irq(pdev, 0);
> > -	if (ret < 0)
> > -		return ret;
> > +	if (ret < 0) {
> > +		dev_err(&pdev->dev, "could not get irq: %d\n",
> > +				ret);
> 
> Why print this out?  And why the odd line-wrapping?
> 
> thanks,
> 
> greg k-h
For the first question, I am just emulating the coding style of the original author who outputs corresponding information after each error. If there is anything unreasonable about doing so, please let me know. As for the second question, it's my mistake and I will correct it immediately.

regrads,
Li Yang




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux