len is never decremented, so ret won't ever be returned, fix this. Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx> --- drivers/hw_random/stm32-rng.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/hw_random/stm32-rng.c b/drivers/hw_random/stm32-rng.c index 440b53684f71..9b28f37ecd88 100644 --- a/drivers/hw_random/stm32-rng.c +++ b/drivers/hw_random/stm32-rng.c @@ -51,7 +51,7 @@ static int stm32_rng_read(struct hwrng *hwrng, void *data, size_t len, bool wait ret = readl_poll_timeout(rng->base + RNG_SR, sr, sr & RNG_SR_DRDY, 10 * USEC_PER_MSEC); if (ret) - goto out; + return ret; if (sr & (RNG_SR_SEIS | RNG_SR_SECS)) { int i; @@ -61,8 +61,7 @@ static int stm32_rng_read(struct hwrng *hwrng, void *data, size_t len, bool wait readl(rng->base + RNG_DR); if (readl(rng->base + RNG_SR) & RNG_SR_SEIS) { pr_warn("RNG Noise"); - ret = -EIO; - goto out; + return -EIO; } /* start again */ @@ -84,8 +83,7 @@ static int stm32_rng_read(struct hwrng *hwrng, void *data, size_t len, bool wait } } -out: - return len ?: ret; + return len; } static int stm32_rng_init(struct hwrng *hwrng) -- 2.30.2 _______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox