[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <36697610-8cea-cebe-9aa0-1da15cc658b6@huawei.com>
Date: Thu, 10 Nov 2022 21:35:22 +0800
From: YueHaibing <yuehaibing@...wei.com>
To: Vinod Koul <vkoul@...nel.org>
CC: <vincent.sunplus@...il.com>, <kishon@...nel.org>,
<linux-usb@...r.kernel.org>, <linux-phy@...ts.infradead.org>,
<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2] phy: usb: sunplus: Fix memleak in update_disc_vol()
On 2022/11/10 15:02, Vinod Koul wrote:
> On 08-11-22, 15:34, YueHaibing wrote:
>> 'otp_v' is allocated in nvmem_cell_read(), it should be freed
>> before return.
>
> Right!
>
>>
>> Fixes: 99d9ccd97385 ("phy: usb: Add USB2.0 phy driver for Sunplus SP7021")
>> Signed-off-by: YueHaibing <yuehaibing@...wei.com>
>> ---
>> v2: free otp_v before return
>> ---
>> drivers/phy/sunplus/phy-sunplus-usb2.c | 3 +++
>> 1 file changed, 3 insertions(+)
>>
>> diff --git a/drivers/phy/sunplus/phy-sunplus-usb2.c b/drivers/phy/sunplus/phy-sunplus-usb2.c
>> index e827b79f6d49..62d5cb5c7c9d 100644
>> --- a/drivers/phy/sunplus/phy-sunplus-usb2.c
>> +++ b/drivers/phy/sunplus/phy-sunplus-usb2.c
>> @@ -105,6 +105,9 @@ static int update_disc_vol(struct sp_usbphy *usbphy)
>> val = (val & ~J_DISC) | set;
>> writel(val, usbphy->phy_regs + CONFIG7);
>>
>> + if (!IS_ERR(otp_v))
>> + kfree(otp_v);
>
> But that is not the case!
Do you think I should changed the commit log like this:
'otp_v' is allocated by nvmem_cell_read(), it should be freed
after usage in update_disc_vol().
>
Powered by blists - more mailing lists