From: YueHaibing <yuehaibing@huawei.com> To: <vincent.sunplus@gmail.com>, <vkoul@kernel.org>, <kishon@kernel.org> Cc: <linux-usb@vger.kernel.org>, <linux-phy@lists.infradead.org>, <linux-kernel@vger.kernel.org>, YueHaibing <yuehaibing@huawei.com> Subject: [PATCH v2] phy: usb: sunplus: Fix memleak in update_disc_vol() Date: Tue, 8 Nov 2022 15:34:30 +0800 [thread overview] Message-ID: <20221108073430.29172-1-yuehaibing@huawei.com> (raw) '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
WARNING: multiple messages have this Message-ID (diff)
From: YueHaibing <yuehaibing@huawei.com> To: <vincent.sunplus@gmail.com>, <vkoul@kernel.org>, <kishon@kernel.org> Cc: <linux-usb@vger.kernel.org>, <linux-phy@lists.infradead.org>, <linux-kernel@vger.kernel.org>, YueHaibing <yuehaibing@huawei.com> Subject: [PATCH v2] phy: usb: sunplus: Fix memleak in update_disc_vol() Date: Tue, 8 Nov 2022 15:34:30 +0800 [thread overview] Message-ID: <20221108073430.29172-1-yuehaibing@huawei.com> (raw) '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
next reply other threads:[~2022-11-08 7:37 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-11-08 7:34 YueHaibing [this message] 2022-11-08 7:34 ` [PATCH v2] phy: usb: sunplus: Fix memleak in update_disc_vol() 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
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20221108073430.29172-1-yuehaibing@huawei.com \ --to=yuehaibing@huawei.com \ --cc=kishon@kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-phy@lists.infradead.org \ --cc=linux-usb@vger.kernel.org \ --cc=vincent.sunplus@gmail.com \ --cc=vkoul@kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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.