[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <eb33b694-b422-a9d5-35dc-2f8af79d47f1@omp.ru>
Date: Wed, 19 Apr 2023 12:00:32 +0300
From: Sergey Shtylyov <s.shtylyov@....ru>
To: Li Yang <lidaxian@...t.edu.cn>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Felipe Balbi <balbi@...nel.org>
CC: Dongliang Mu <dzm91@...t.edu.cn>, <linux-usb@...r.kernel.org>,
<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] usb: phy: phy-tahvo: fix memory leak in tahvo_usb_probe()
On 4/18/23 2:17 PM, Sergey Shtylyov 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.
>
> Oops, I'm sorry for missing that one...
>
>> Fixes: 0d45a1373e66 ("usb: phy: tahvo: add IRQ check")
>> Signed-off-by: Li Yang <lidaxian@...t.edu.cn>
>> Reviewed-by: Dongliang Mu <dzm91@...t.edu.cn>
>> ---
>> 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);
>
> Adding the error message needs another patch, strictly speaking...
And if you look at platform_get_irq(), you'll see that it prints an error msg
itself...
[...]
MBR, Sergey
Powered by blists - more mailing lists