mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sergey Shtylyov <s.shtylyov@omp.ru>
To: Vincent Shih <vincent.sunplus@gmail.com>, <kishon@ti.com>,
	<vkoul@kernel.org>, <linux-usb@vger.kernel.org>,
	<linux-phy@lists.infradead.org>, <linux-kernel@vger.kernel.org>,
	<wells.lu@sunplus.com>
Subject: Re: [PATCH] phy: usb: free the buffer after reading a given nvmem cell
Date: Tue, 6 Sep 2022 11:27:32 +0300	[thread overview]
Message-ID: <9d396131-72da-772b-3027-89d390cad1fa@omp.ru> (raw)
In-Reply-To: <1662445382-29879-1-git-send-email-vincent.sunplus@gmail.com>

Hello!

On 9/6/22 9:23 AM, Vincent Shih wrote:

> Use kfree() to free the buffer after calling nvmem_cell_read() to
> read a given nvmem cell.

   Your patch does more than just that. It looks like we need 2 patches here...

> Fixes:99d9ccd97385("phy: usb: Add USB2.0 phy driver for Sunplus SP7021")

   Need spaces after : and before (.

> Signed-off-by: Vincent Shih <vincent.sunplus@gmail.com>
> ---
>  drivers/phy/sunplus/phy-sunplus-usb2.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/phy/sunplus/phy-sunplus-usb2.c b/drivers/phy/sunplus/phy-sunplus-usb2.c
> index 5269968..c8540e1 100644
> --- a/drivers/phy/sunplus/phy-sunplus-usb2.c
> +++ b/drivers/phy/sunplus/phy-sunplus-usb2.c
[...]
> @@ -92,13 +93,15 @@ static int update_disc_vol(struct sp_usbphy *usbphy)
>  	otp_v = nvmem_cell_read(cell, &otp_l);
>  	nvmem_cell_put(cell);
>  
> -	if (otp_v) {
> +	if (!IS_ERR(otp_v)) {

   This needs a separate patch, I think...

>  		set = *(otp_v + 1);
>  		set = (set << (sizeof(char) * 8)) | *otp_v;
>  		set = (set >> usbphy->disc_vol_addr_off) & J_DISC;
> +		
> +		kfree(otp_v);
>  	}
> -
> -	if (!otp_v || set == 0)
> +	
> +	if (IS_ERR(otp_v) || (set == 0))
>  		set = OTP_DISC_LEVEL_DEFAULT;
>  
>  	val = readl(usbphy->phy_regs + CONFIG7);
> @@ -294,3 +297,4 @@ module_platform_driver(sunplus_usb_phy_driver);
>  MODULE_AUTHOR("Vincent Shih <vincent.shih@sunplus.com>");
>  MODULE_DESCRIPTION("Sunplus USB 2.0 phy driver");
>  MODULE_LICENSE("GPL");
> +

   Huh? :-)

MBR, Sergey

      parent reply	other threads:[~2022-09-06  8:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-06  6:23 Vincent Shih
2022-09-06  6:38 ` Greg KH
2022-09-06  8:27 ` Sergey Shtylyov [this message]

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=9d396131-72da-772b-3027-89d390cad1fa@omp.ru \
    --to=s.shtylyov@omp.ru \
    --cc=kishon@ti.com \
    --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 \
    --cc=wells.lu@sunplus.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 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®