* [PATCH v2] phy: usb: sunplus: Fix memleak in update_disc_vol()
@ 2022-11-08 7:34 ` YueHaibing
0 siblings, 0 replies; 6+ messages in thread
From: YueHaibing @ 2022-11-08 7:34 UTC (permalink / raw)
To: vincent.sunplus, vkoul, kishon
Cc: linux-usb, linux-phy, linux-kernel, YueHaibing
'otp_v' is allocated in nvmem_cell_read(), it should be freed
before return.
Fixes: 99d9ccd97385 ("phy: usb: Add USB2.0 phy driver for Sunplus SP7021")
Signed-off-by: YueHaibing <yuehaibing@huawei.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);
+
return 0;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2] phy: usb: sunplus: Fix memleak in update_disc_vol()
@ 2022-11-08 7:34 ` YueHaibing
0 siblings, 0 replies; 6+ messages in thread
From: YueHaibing @ 2022-11-08 7:34 UTC (permalink / raw)
To: vincent.sunplus, vkoul, kishon
Cc: linux-usb, linux-phy, linux-kernel, YueHaibing
'otp_v' is allocated in nvmem_cell_read(), it should be freed
before return.
Fixes: 99d9ccd97385 ("phy: usb: Add USB2.0 phy driver for Sunplus SP7021")
Signed-off-by: YueHaibing <yuehaibing@huawei.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);
+
return 0;
}
--
2.17.1
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2] phy: usb: sunplus: Fix memleak in update_disc_vol()
2022-11-08 7:34 ` YueHaibing
@ 2022-11-10 7:02 ` Vinod Koul
-1 siblings, 0 replies; 6+ messages in thread
From: Vinod Koul @ 2022-11-10 7:02 UTC (permalink / raw)
To: YueHaibing; +Cc: vincent.sunplus, kishon, linux-usb, linux-phy, linux-kernel
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@huawei.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!
--
~Vinod
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] phy: usb: sunplus: Fix memleak in update_disc_vol()
@ 2022-11-10 7:02 ` Vinod Koul
0 siblings, 0 replies; 6+ messages in thread
From: Vinod Koul @ 2022-11-10 7:02 UTC (permalink / raw)
To: YueHaibing; +Cc: vincent.sunplus, kishon, linux-usb, linux-phy, linux-kernel
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@huawei.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!
--
~Vinod
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] phy: usb: sunplus: Fix memleak in update_disc_vol()
2022-11-10 7:02 ` Vinod Koul
@ 2022-11-10 13:35 ` YueHaibing
-1 siblings, 0 replies; 6+ messages in thread
From: YueHaibing @ 2022-11-10 13:35 UTC (permalink / raw)
To: Vinod Koul; +Cc: vincent.sunplus, kishon, linux-usb, linux-phy, linux-kernel
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@huawei.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().
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] phy: usb: sunplus: Fix memleak in update_disc_vol()
@ 2022-11-10 13:35 ` YueHaibing
0 siblings, 0 replies; 6+ messages in thread
From: YueHaibing @ 2022-11-10 13:35 UTC (permalink / raw)
To: Vinod Koul; +Cc: vincent.sunplus, kishon, linux-usb, linux-phy, linux-kernel
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@huawei.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().
>
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-11-10 13:35 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-08 7:34 [PATCH v2] phy: usb: sunplus: Fix memleak in update_disc_vol() YueHaibing
2022-11-08 7:34 ` YueHaibing
2022-11-10 7:02 ` Vinod Koul
2022-11-10 7:02 ` Vinod Koul
2022-11-10 13:35 ` YueHaibing
2022-11-10 13:35 ` YueHaibing
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.