mfd: db8500-prcmu: Check return of devm_ioremap for error
authorPramod Gurav <pramod.gurav@smartplayin.com>
Thu, 30 Oct 2014 09:21:35 +0000 (14:51 +0530)
committerLee Jones <lee.jones@linaro.org>
Tue, 25 Nov 2014 16:18:49 +0000 (16:18 +0000)
Error check around return value of devm_ioremap is missing. Add the same
to avoid NULL pointer dereference.

Signed-off-by: Pramod Gurav <pramod.gurav@smartplayin.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
drivers/mfd/db8500-prcmu.c

index 193cf168ba84d1b08cfb2d419202f80025f61954..89ae8bf665b4746231f8c280f8d886f24ceb011f 100644 (file)
@@ -3167,6 +3167,11 @@ static int db8500_prcmu_probe(struct platform_device *pdev)
        }
        tcdm_base = devm_ioremap(&pdev->dev, res->start,
                        resource_size(res));
+       if (!tcdm_base) {
+               dev_err(&pdev->dev,
+                       "failed to ioremap prcmu-tcdm register memory\n");
+               return -ENOENT;
+       }
 
        /* Clean up the mailbox interrupts after pre-kernel code. */
        writel(ALL_MBOX_BITS, PRCM_ARM_IT1_CLR);