Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1ff69adf authored by Maxime Coquelin's avatar Maxime Coquelin Committed by Herbert Xu
Browse files

hwrng: stm32 - fix maybe uninitialized variable warning



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: default avatarSudip Mukherjee <sudip.mukherjee@codethink.co.uk>
Suggested-by: default avatarArnd Bergmann <arnd@arndb.de>
Cc: Daniel Thompson <daniel.thompson@linaro.org>
Signed-off-by: default avatarMaxime Coquelin <mcoquelin.stm32@gmail.com>
Reviewed-by: default avatarDaniel Thompson <daniel.thompson@linaro.org>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent f6c60b15
Loading
Loading
Loading
Loading
+5 −5
Original line number Original line Diff line number Diff line
@@ -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 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;
			break;
		}


		*(u32 *)data = readl_relaxed(priv->base + RNG_DR);
		*(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);
		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_mark_last_busy((struct device *) priv->rng.priv);
	pm_runtime_put_sync_autosuspend((struct device *) priv->rng.priv);
	pm_runtime_put_sync_autosuspend((struct device *) priv->rng.priv);