linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: daniel.thompson@linaro.org (Daniel Thompson)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] hwrng: stm32: fix maybe uninitialized variable warning
Date: Fri, 27 May 2016 14:46:58 +0100	[thread overview]
Message-ID: <fc45dc72-6dd9-071c-5bc0-c2ee01b99511@linaro.org> (raw)
In-Reply-To: <1464255297-21090-1-git-send-email-mcoquelin.stm32@gmail.com>

On 26/05/16 10:34, Maxime Coquelin wrote:
> This patch fixes the following warning:
> drivers/char/hw_random/stm32-rng.c: In function 'stm32_rng_read':
> drivers/char/hw_random/stm32-rng.c:82:19: warning: 'sr' may be used
>                                         uninitialized in this function
>
> Reported-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
> Suggested-by: Arnd Bergmann <arnd@arndb.de>
> Cc: Daniel Thompson <daniel.thompson@linaro.org>

Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>


> Signed-off-by: Maxime Coquelin <mcoquelin.stm32@gmail.com>
> ---
>  drivers/char/hw_random/stm32-rng.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/char/hw_random/stm32-rng.c b/drivers/char/hw_random/stm32-rng.c
> index 92a810648bd0..63d84e6f1891 100644
> --- a/drivers/char/hw_random/stm32-rng.c
> +++ b/drivers/char/hw_random/stm32-rng.c
> @@ -69,8 +69,12 @@ static int stm32_rng_read(struct hwrng *rng, void *data, size_t max, bool wait)
>  		}
>
>  		/* If error detected or data not ready... */
> -		if (sr != RNG_SR_DRDY)
> +		if (sr != RNG_SR_DRDY) {
> +			if (WARN_ONCE(sr & (RNG_SR_SEIS | RNG_SR_CEIS),
> +					"bad RNG status - %x\n", sr))
> +				writel_relaxed(0, priv->base + RNG_SR);
>  			break;
> +		}
>
>  		*(u32 *)data = readl_relaxed(priv->base + RNG_DR);
>
> @@ -79,10 +83,6 @@ static int stm32_rng_read(struct hwrng *rng, void *data, size_t max, bool wait)
>  		max -= sizeof(u32);
>  	}
>
> -	if (WARN_ONCE(sr & (RNG_SR_SEIS | RNG_SR_CEIS),
> -		      "bad RNG status - %x\n", sr))
> -		writel_relaxed(0, priv->base + RNG_SR);
> -
>  	pm_runtime_mark_last_busy((struct device *) priv->rng.priv);
>  	pm_runtime_put_sync_autosuspend((struct device *) priv->rng.priv);
>
>

  reply	other threads:[~2016-05-27 13:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-26  9:34 [PATCH] hwrng: stm32: fix maybe uninitialized variable warning Maxime Coquelin
2016-05-27 13:46 ` Daniel Thompson [this message]
2016-05-31 10:18 ` Herbert Xu

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=fc45dc72-6dd9-071c-5bc0-c2ee01b99511@linaro.org \
    --to=daniel.thompson@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.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: 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;
as well as URLs for NNTP newsgroup(s).