All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shuah Khan <skhan@linuxfoundation.org>
To: Karol Przybylski <karprzy7@gmail.com>,
	aaro.koskinen@iki.fi, andreas@kemnade.info, khilman@baylibre.com,
	rogerq@kernel.org, tony@atomide.com, lee@kernel.org
Cc: linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org,
	Shuah Khan <skhan@linuxfoundation.org>
Subject: Re: [PATCH] mfd: omap-usb-tll: handle clk_prepare return code in usbtll_omap_probe
Date: Wed, 6 Nov 2024 16:03:44 -0700	[thread overview]
Message-ID: <a18a7906-b213-4dde-abfc-2503250ad1bf@linuxfoundation.org> (raw)
In-Reply-To: <20241106223324.479341-1-karprzy7@gmail.com>

On 11/6/24 15:33, Karol Przybylski wrote:
> clk_prepare() is called in usbtll_omap_probe to fill clk array.
> Return code is not checked, leaving possible error condition unhandled.
> 
> Added variable to hold return value from clk_prepare() and return statement
> when it's not successful.
> 
> Found in coverity scan, CID 1594680
> 
> Signed-off-by: Karol Przybylski <karprzy7@gmail.com>
> ---
>   drivers/mfd/omap-usb-tll.c | 8 ++++++--
>   1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mfd/omap-usb-tll.c b/drivers/mfd/omap-usb-tll.c
> index 0f7fdb99c809..28446b082c85 100644
> --- a/drivers/mfd/omap-usb-tll.c
> +++ b/drivers/mfd/omap-usb-tll.c
> @@ -202,7 +202,7 @@ static int usbtll_omap_probe(struct platform_device *pdev)
>   	struct device				*dev =  &pdev->dev;
>   	struct usbtll_omap			*tll;
>   	void __iomem				*base;
> -	int					i, nch, ver;
> +	int					i, nch, ver, err;
>   
>   	dev_dbg(dev, "starting TI HSUSB TLL Controller\n");
>   
> @@ -251,7 +251,11 @@ static int usbtll_omap_probe(struct platform_device *pdev)
>   		if (IS_ERR(tll->ch_clk[i]))
>   			dev_dbg(dev, "can't get clock : %s\n", clkname);
>   		else
> -			clk_prepare(tll->ch_clk[i]);

Braces for the conditional don't looks right.

> +			err = clk_prepare(tll->ch_clk[i]);
> +			if (err) {
> +				dev_err(dev, "Unable to prepare clock\n");
> +				return err;

Did you check to see if callers handle this new error return
in this path?

> +	}

Same here

>   	}
>   

Same here
>   	pm_runtime_put_sync(dev);

thanks,
-- Shuah


  reply	other threads:[~2024-11-06 23:03 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-06 22:33 [PATCH] mfd: omap-usb-tll: handle clk_prepare return code in usbtll_omap_probe Karol Przybylski
2024-11-06 23:03 ` Shuah Khan [this message]
2024-11-06 23:15 ` Andreas Kemnade
2024-11-07 11:12   ` Karol P
2024-11-09 23:29     ` Andreas Kemnade
2024-11-11 14:41       ` Roger Quadros
2024-11-11 19:57         ` Andreas Kemnade
2024-11-12 11:59           ` Karol P

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=a18a7906-b213-4dde-abfc-2503250ad1bf@linuxfoundation.org \
    --to=skhan@linuxfoundation.org \
    --cc=aaro.koskinen@iki.fi \
    --cc=andreas@kemnade.info \
    --cc=karprzy7@gmail.com \
    --cc=khilman@baylibre.com \
    --cc=lee@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=rogerq@kernel.org \
    --cc=tony@atomide.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.