mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] phy: usb: sunplus: Fix memleak in update_disc_vol()
@ 2022-11-08  6:11 YueHaibing
  2022-11-08  6:38 ` Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: YueHaibing @ 2022-11-08  6:11 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>
---
 drivers/phy/sunplus/phy-sunplus-usb2.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/phy/sunplus/phy-sunplus-usb2.c b/drivers/phy/sunplus/phy-sunplus-usb2.c
index e827b79f6d49..450cf8e6d7fb 100644
--- a/drivers/phy/sunplus/phy-sunplus-usb2.c
+++ b/drivers/phy/sunplus/phy-sunplus-usb2.c
@@ -96,6 +96,7 @@ static int update_disc_vol(struct sp_usbphy *usbphy)
 		set = *(otp_v + 1);
 		set = (set << (sizeof(char) * 8)) | *otp_v;
 		set = (set >> usbphy->disc_vol_addr_off) & J_DISC;
+		kfree(otp_v);
 	}
 
 	if (IS_ERR(otp_v) || set == 0)
-- 
2.17.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-11-08  7:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-08  6:11 [PATCH] phy: usb: sunplus: Fix memleak in update_disc_vol() YueHaibing
2022-11-08  6:38 ` Greg KH
2022-11-08  7:05   ` YueHaibing

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®