spi: pic32: Fix checking return value of devm_ioremap_resource
authorAxel Lin <axel.lin@ingics.com>
Wed, 27 Apr 2016 08:19:26 +0000 (16:19 +0800)
committerMark Brown <broonie@kernel.org>
Fri, 29 Apr 2016 11:34:20 +0000 (12:34 +0100)
devm_ioremap_resource() returns ERR_PTR on error.
Also remove the redundant dev_err message, the implementation of
devm_ioremap_resource() already print error messages on error paths.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-pic32.c

index 4eeb8a85b0306066a3b500f1034d7ed1fb7149bc..73db87f805a1fb1b76d57518da9748d2bed4a164 100644 (file)
@@ -711,10 +711,9 @@ static int pic32_spi_hw_probe(struct platform_device *pdev,
 
        mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
        pic32s->regs = devm_ioremap_resource(&pdev->dev, mem);
-       if (!pic32s->regs) {
-               dev_err(&pdev->dev, "ioremap() failed\n");
-               return -ENOMEM;
-       }
+       if (IS_ERR(pic32s->regs))
+               return PTR_ERR(pic32s->regs);
+
        pic32s->dma_base = mem->start;
 
        /* get irq resources: err-irq, rx-irq, tx-irq */