hwrng: bcm2835 - handle of_iomap failures
authorArvind Yadav <arvind.yadav.cs@gmail.com>
Mon, 29 Aug 2016 17:10:16 +0000 (22:40 +0530)
committerHerbert Xu <herbert@gondor.apana.org.au>
Wed, 7 Sep 2016 13:08:24 +0000 (21:08 +0800)
Check return value of of_iomap and handle errors correctly.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Acked-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/char/hw_random/bcm2835-rng.c

index af2149273fe049b075d0953034cda0aab1525f23..574211a495491d9d6021dcaefe4274a63ed02055 100644 (file)
@@ -92,9 +92,10 @@ static int bcm2835_rng_probe(struct platform_device *pdev)
        bcm2835_rng_ops.priv = (unsigned long)rng_base;
 
        rng_id = of_match_node(bcm2835_rng_of_match, np);
-       if (!rng_id)
+       if (!rng_id) {
+               iounmap(rng_base);
                return -EINVAL;
-
+       }
        /* Check for rng init function, execute it */
        rng_setup = rng_id->data;
        if (rng_setup)