Sanity check on resource happening with devm_ioremap_resource().

Signed-off-by: Varka Bhadram <[email protected]>
---
 drivers/spi/spi-omap2-mcspi.c |   11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c
index 893c3d7..305c649 100644
--- a/drivers/spi/spi-omap2-mcspi.c
+++ b/drivers/spi/spi-omap2-mcspi.c
@@ -1213,8 +1213,9 @@ static int omap2_mcspi_probe(struct platform_device *pdev)
        regs_offset = pdata->regs_offset;
 
        r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       if (r == NULL) {
-               status = -ENODEV;
+       mcspi->base = devm_ioremap_resource(&pdev->dev, r);
+       if (IS_ERR(mcspi->base)) {
+               status = PTR_ERR(mcspi->base);
                goto free_master;
        }
 
@@ -1222,12 +1223,6 @@ static int omap2_mcspi_probe(struct platform_device 
*pdev)
        r->end += regs_offset;
        mcspi->phys = r->start;
 
-       mcspi->base = devm_ioremap_resource(&pdev->dev, r);
-       if (IS_ERR(mcspi->base)) {
-               status = PTR_ERR(mcspi->base);
-               goto free_master;
-       }
-
        mcspi->dev = &pdev->dev;
 
        INIT_LIST_HEAD(&mcspi->ctx.cs);
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to