spi: ath79: simplify iomem resource mapping
authorHeiner Kallweit <hkallweit1@gmail.com>
Sun, 27 Sep 2015 16:47:35 +0000 (18:47 +0200)
committerMark Brown <broonie@kernel.org>
Wed, 30 Sep 2015 19:33:29 +0000 (20:33 +0100)
Simplify the code by switching from devm_ioremap to devm_ioremap_resource.
Checking the result of platform_get_resource is not needed as
devm_ioremap_resource checks the provided resource argument for NULL.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-ath79.c

index bf1f9b32c597b502f0d1c51b7f33f64a4996fb25..6165bf21d42750af1f765f2e79bc9a9a51ea734c 100644 (file)
@@ -240,14 +240,9 @@ static int ath79_spi_probe(struct platform_device *pdev)
        sp->bitbang.flags = SPI_CS_HIGH;
 
        r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       if (r == NULL) {
-               ret = -ENOENT;
-               goto err_put_master;
-       }
-
-       sp->base = devm_ioremap(&pdev->dev, r->start, resource_size(r));
-       if (!sp->base) {
-               ret = -ENXIO;
+       sp->base = devm_ioremap_resource(&pdev->dev, r);
+       if (IS_ERR(sp->base)) {
+               ret = PTR_ERR(sp->base);
                goto err_put_master;
        }