Message ID | 20240419050201.181041-1-marex@denx.de (mailing list archive) |
---|---|
State | Accepted |
Delegated to: | Herbert Xu |
Headers | show |
Series | [1/3] hwrng: stm32 - use logical OR in conditional | expand |
On Fri, Apr 19, 2024 at 07:01:12AM +0200, Marek Vasut wrote: > The conditional is used to check whether err is non-zero OR whether > reg variable is non-zero after clearing bits from it. This should be > done using logical OR, not bitwise OR, fix it. > > Fixes: 6b85a7e141cb ("hwrng: stm32 - implement STM32MP13x support") > Signed-off-by: Marek Vasut <marex@denx.de> > --- > Cc: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de> > Cc: Alexandre Torgue <alexandre.torgue@foss.st.com> > Cc: Gatien Chevallier <gatien.chevallier@foss.st.com> > Cc: Herbert Xu <herbert@gondor.apana.org.au> > Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com> > Cc: Olivia Mackall <olivia@selenic.com> > Cc: Rob Herring <robh@kernel.org> > Cc: Yang Yingliang <yangyingliang@huawei.com> > Cc: kernel@dh-electronics.com > Cc: linux-arm-kernel@lists.infradead.org > Cc: linux-crypto@vger.kernel.org > Cc: linux-stm32@st-md-mailman.stormreply.com > --- > drivers/char/hw_random/stm32-rng.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) All applied. Thanks.
diff --git a/drivers/char/hw_random/stm32-rng.c b/drivers/char/hw_random/stm32-rng.c index 379bc245c5202..1cc61ef8ee54c 100644 --- a/drivers/char/hw_random/stm32-rng.c +++ b/drivers/char/hw_random/stm32-rng.c @@ -353,7 +353,7 @@ static int stm32_rng_init(struct hwrng *rng) err = readl_relaxed_poll_timeout_atomic(priv->base + RNG_SR, reg, reg & RNG_SR_DRDY, 10, 100000); - if (err | (reg & ~RNG_SR_DRDY)) { + if (err || (reg & ~RNG_SR_DRDY)) { clk_disable_unprepare(priv->clk); dev_err((struct device *)priv->rng.priv, "%s: timeout:%x SR: %x!\n", __func__, err, reg);
The conditional is used to check whether err is non-zero OR whether reg variable is non-zero after clearing bits from it. This should be done using logical OR, not bitwise OR, fix it. Fixes: 6b85a7e141cb ("hwrng: stm32 - implement STM32MP13x support") Signed-off-by: Marek Vasut <marex@denx.de> --- Cc: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de> Cc: Alexandre Torgue <alexandre.torgue@foss.st.com> Cc: Gatien Chevallier <gatien.chevallier@foss.st.com> Cc: Herbert Xu <herbert@gondor.apana.org.au> Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com> Cc: Olivia Mackall <olivia@selenic.com> Cc: Rob Herring <robh@kernel.org> Cc: Yang Yingliang <yangyingliang@huawei.com> Cc: kernel@dh-electronics.com Cc: linux-arm-kernel@lists.infradead.org Cc: linux-crypto@vger.kernel.org Cc: linux-stm32@st-md-mailman.stormreply.com --- drivers/char/hw_random/stm32-rng.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)