hwrng: imx-rngc - fix an error path
authorMartin Kaiser <martin@kaiser.cx>
Thu, 5 Mar 2020 20:58:20 +0000 (21:58 +0100)
committerHerbert Xu <herbert@gondor.apana.org.au>
Thu, 12 Mar 2020 12:00:15 +0000 (23:00 +1100)
Make sure that the rngc interrupt is masked if the rngc self test fails.
Self test failure means that probe fails as well. Interrupts should be
masked in this case, regardless of the error.

Cc: stable@vger.kernel.org
Fixes: 1d5449445bd0 ("hwrng: mx-rngc - add a driver for Freescale RNGC")
Reviewed-by: PrasannaKumar Muralidharan <prasannatsmkumar@gmail.com>
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/char/hw_random/imx-rngc.c

index 30cf00f8e9a09ad3c57b0c4190080cd38311f669..0576801944fdd0e43130416965a56d3634271734 100644 (file)
@@ -105,8 +105,10 @@ static int imx_rngc_self_test(struct imx_rngc *rngc)
                return -ETIMEDOUT;
        }
 
-       if (rngc->err_reg != 0)
+       if (rngc->err_reg != 0) {
+               imx_rngc_irq_mask_clear(rngc);
                return -EIO;
+       }
 
        return 0;
 }