public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] USB: phy: tahvo: Add check for clk_enable()
@ 2024-12-15 21:00 Mingwei Zheng
  2024-12-16  7:56 ` Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: Mingwei Zheng @ 2024-12-15 21:00 UTC (permalink / raw)
  To: gregkh, u.kleine-koenig, aaro.koskinen, balbi
  Cc: linux-usb, linux-kernel, Mingwei Zheng, Jiasheng Jiang

Add check for the return value of clk_enable() to catch the potential
error.

Fixes: 9ba96ae5074c ("usb: omap1: Tahvo USB transceiver driver")
Signed-off-by: Mingwei Zheng <zmw12306@gmail.com>
Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
---
 drivers/usb/phy/phy-tahvo.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/phy/phy-tahvo.c b/drivers/usb/phy/phy-tahvo.c
index ae7bf3ff89ee..0b8801318cd2 100644
--- a/drivers/usb/phy/phy-tahvo.c
+++ b/drivers/usb/phy/phy-tahvo.c
@@ -342,8 +342,11 @@ static int tahvo_usb_probe(struct platform_device *pdev)
 	mutex_init(&tu->serialize);
 
 	tu->ick = devm_clk_get(&pdev->dev, "usb_l4_ick");
-	if (!IS_ERR(tu->ick))
-		clk_enable(tu->ick);
+	if (!IS_ERR(tu->ick)) {
+		ret = clk_enable(tu->ick);
+		if (ret)
+			return ret;
+	}
 
 	/*
 	 * Set initial state, so that we generate kevents only on state changes.
-- 
2.34.1


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

* Re: [PATCH] USB: phy: tahvo: Add check for clk_enable()
  2024-12-15 21:00 [PATCH] USB: phy: tahvo: Add check for clk_enable() Mingwei Zheng
@ 2024-12-16  7:56 ` Greg KH
  2024-12-18  3:09   ` Mingwei Zheng
  0 siblings, 1 reply; 3+ messages in thread
From: Greg KH @ 2024-12-16  7:56 UTC (permalink / raw)
  To: Mingwei Zheng
  Cc: u.kleine-koenig, aaro.koskinen, balbi, linux-usb, linux-kernel,
	Jiasheng Jiang

On Sun, Dec 15, 2024 at 04:00:06PM -0500, Mingwei Zheng wrote:
> Add check for the return value of clk_enable() to catch the potential
> error.
> 
> Fixes: 9ba96ae5074c ("usb: omap1: Tahvo USB transceiver driver")
> Signed-off-by: Mingwei Zheng <zmw12306@gmail.com>
> Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
> ---
>  drivers/usb/phy/phy-tahvo.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/phy/phy-tahvo.c b/drivers/usb/phy/phy-tahvo.c
> index ae7bf3ff89ee..0b8801318cd2 100644
> --- a/drivers/usb/phy/phy-tahvo.c
> +++ b/drivers/usb/phy/phy-tahvo.c
> @@ -342,8 +342,11 @@ static int tahvo_usb_probe(struct platform_device *pdev)
>  	mutex_init(&tu->serialize);
>  
>  	tu->ick = devm_clk_get(&pdev->dev, "usb_l4_ick");
> -	if (!IS_ERR(tu->ick))
> -		clk_enable(tu->ick);
> +	if (!IS_ERR(tu->ick)) {
> +		ret = clk_enable(tu->ick);
> +		if (ret)
> +			return ret;
> +	}

Same questions, why the signed-off-by order and how was this found and
tested?

thanks,

greg k-h

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

* Re: [PATCH] USB: phy: tahvo: Add check for clk_enable()
  2024-12-16  7:56 ` Greg KH
@ 2024-12-18  3:09   ` Mingwei Zheng
  0 siblings, 0 replies; 3+ messages in thread
From: Mingwei Zheng @ 2024-12-18  3:09 UTC (permalink / raw)
  To: Greg KH
  Cc: u.kleine-koenig, aaro.koskinen, balbi, linux-usb, linux-kernel,
	Jiasheng Jiang

Hi Greg,

On Mon, Dec 16, 2024 at 2:56 AM Greg KH <gregkh@linuxfoundation.org> wrote:
>
> On Sun, Dec 15, 2024 at 04:00:06PM -0500, Mingwei Zheng wrote:
> > Add check for the return value of clk_enable() to catch the potential
> > error.
> >
> > Fixes: 9ba96ae5074c ("usb: omap1: Tahvo USB transceiver driver")
> > Signed-off-by: Mingwei Zheng <zmw12306@gmail.com>
> > Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
> > ---
> >  drivers/usb/phy/phy-tahvo.c | 7 +++++--
> >  1 file changed, 5 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/usb/phy/phy-tahvo.c b/drivers/usb/phy/phy-tahvo.c
> > index ae7bf3ff89ee..0b8801318cd2 100644
> > --- a/drivers/usb/phy/phy-tahvo.c
> > +++ b/drivers/usb/phy/phy-tahvo.c
> > @@ -342,8 +342,11 @@ static int tahvo_usb_probe(struct platform_device *pdev)
> >       mutex_init(&tu->serialize);
> >
> >       tu->ick = devm_clk_get(&pdev->dev, "usb_l4_ick");
> > -     if (!IS_ERR(tu->ick))
> > -             clk_enable(tu->ick);
> > +     if (!IS_ERR(tu->ick)) {
> > +             ret = clk_enable(tu->ick);
> > +             if (ret)
> > +                     return ret;
> > +     }
>
> Same questions, why the signed-off-by order and how was this found and
> tested?
>
> thanks,
>
> greg k-h

We wrote the patch together so I listed both of our names.

We used a static analysis tool to find this. Additionally, we
validated the patch's correctness
using the built-in tests provided during the compilation process.

Please kindly let me know if you have any questions or suggestions. Thank you!


Best,
Mingwei

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

end of thread, other threads:[~2024-12-18  3:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-15 21:00 [PATCH] USB: phy: tahvo: Add check for clk_enable() Mingwei Zheng
2024-12-16  7:56 ` Greg KH
2024-12-18  3:09   ` Mingwei Zheng

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