From: Vinod Koul <vkoul@kernel.org>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Cc: Vincent Shih <vincent.sunplus@gmail.com>,
Kishon Vijay Abraham I <kishon@kernel.org>,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
linux-usb@vger.kernel.org, linux-phy@lists.infradead.org
Subject: Re: [PATCH] phy: sunplus: Fix a memory leak in update_disc_vol()
Date: Tue, 30 Jan 2024 22:40:21 +0530 [thread overview]
Message-ID: <ZbktfWM3bzuRrMok@matsya> (raw)
In-Reply-To: <451016052782f18c8b52ed0f836d7ab5c69bac3d.1706431643.git.christophe.jaillet@wanadoo.fr>
On 28-01-24, 09:47, Christophe JAILLET wrote:
> '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@wanadoo.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);
Looking at documentation, this should be nvmem_cell_put() see:
Documentation/driver-api/nvmem.rst
What do you suggest Srini?
> +
> return 0;
> }
>
> --
> 2.43.0
--
~Vinod
WARNING: multiple messages have this Message-ID (diff)
From: Vinod Koul <vkoul@kernel.org>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Cc: Vincent Shih <vincent.sunplus@gmail.com>,
Kishon Vijay Abraham I <kishon@kernel.org>,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
linux-usb@vger.kernel.org, linux-phy@lists.infradead.org
Subject: Re: [PATCH] phy: sunplus: Fix a memory leak in update_disc_vol()
Date: Tue, 30 Jan 2024 22:40:21 +0530 [thread overview]
Message-ID: <ZbktfWM3bzuRrMok@matsya> (raw)
In-Reply-To: <451016052782f18c8b52ed0f836d7ab5c69bac3d.1706431643.git.christophe.jaillet@wanadoo.fr>
On 28-01-24, 09:47, Christophe JAILLET wrote:
> '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@wanadoo.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);
Looking at documentation, this should be nvmem_cell_put() see:
Documentation/driver-api/nvmem.rst
What do you suggest Srini?
> +
> return 0;
> }
>
> --
> 2.43.0
--
~Vinod
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
next prev parent reply other threads:[~2024-01-30 17:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-28 8:47 [PATCH] phy: sunplus: Fix a memory leak in update_disc_vol() Christophe JAILLET
2024-01-28 8:47 ` Christophe JAILLET
2024-01-30 17:10 ` Vinod Koul [this message]
2024-01-30 17:10 ` Vinod Koul
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=ZbktfWM3bzuRrMok@matsya \
--to=vkoul@kernel.org \
--cc=christophe.jaillet@wanadoo.fr \
--cc=kernel-janitors@vger.kernel.org \
--cc=kishon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=linux-usb@vger.kernel.org \
--cc=srinivas.kandagatla@linaro.org \
--cc=vincent.sunplus@gmail.com \
/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: link
Be 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.