[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <451016052782f18c8b52ed0f836d7ab5c69bac3d.1706431643.git.christophe.jaillet@wanadoo.fr>
Date: Sun, 28 Jan 2024 09:47:50 +0100
From: Christophe JAILLET <christophe.jaillet@...adoo.fr>
To: Vincent Shih <vincent.sunplus@...il.com>,
Vinod Koul <vkoul@...nel.org>,
Kishon Vijay Abraham I <kishon@...nel.org>
Cc: linux-kernel@...r.kernel.org,
kernel-janitors@...r.kernel.org,
Christophe JAILLET <christophe.jaillet@...adoo.fr>,
linux-usb@...r.kernel.org,
linux-phy@...ts.infradead.org
Subject: [PATCH] phy: sunplus: Fix a memory leak in update_disc_vol()
'otp_v', allocated by nvmem_cell_read(), is leaking.
It must be freed before leaving the function to avoid a leak.
Fixes: 99d9ccd97385 ("phy: usb: Add USB2.0 phy driver for Sunplus SP7021")
Signed-off-by: Christophe JAILLET <christophe.jaillet@...adoo.fr>
---
This patch is speculative and based on comparison on the usage of
nvmem_cell_read() in other driver.
Review with care.
---
drivers/phy/sunplus/phy-sunplus-usb2.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/phy/sunplus/phy-sunplus-usb2.c b/drivers/phy/sunplus/phy-sunplus-usb2.c
index 637a5fbae6d9..50f1f91ac052 100644
--- a/drivers/phy/sunplus/phy-sunplus-usb2.c
+++ b/drivers/phy/sunplus/phy-sunplus-usb2.c
@@ -105,6 +105,8 @@ static int update_disc_vol(struct sp_usbphy *usbphy)
val = (val & ~J_DISC) | set;
writel(val, usbphy->phy_regs + CONFIG7);
+ kfree(otp_v);
+
return 0;
}
--
2.43.0
Powered by blists - more mailing lists