spi: lp-8841: use devm_platform_ioremap_resource() to simplify code
authorYueHaibing <yuehaibing@huawei.com>
Wed, 4 Sep 2019 13:58:56 +0000 (21:58 +0800)
committerMark Brown <broonie@kernel.org>
Wed, 4 Sep 2019 16:18:35 +0000 (17:18 +0100)
Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Link: https://lore.kernel.org/r/20190904135918.25352-15-yuehaibing@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-lp8841-rtc.c

index f50779fd329cdef33010741bdeaebf2dd58b0e98..2d436541d6c2aa6bb86c9466495f7c03a92c73d7 100644 (file)
@@ -185,7 +185,6 @@ spi_lp8841_rtc_probe(struct platform_device *pdev)
        int                             ret;
        struct spi_master               *master;
        struct spi_lp8841_rtc           *data;
-       void                            *iomem;
 
        master = spi_alloc_master(&pdev->dev, sizeof(*data));
        if (!master)
@@ -207,8 +206,7 @@ spi_lp8841_rtc_probe(struct platform_device *pdev)
 
        data = spi_master_get_devdata(master);
 
-       iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       data->iomem = devm_ioremap_resource(&pdev->dev, iomem);
+       data->iomem = devm_platform_ioremap_resource(pdev, 0);
        ret = PTR_ERR_OR_ZERO(data->iomem);
        if (ret) {
                dev_err(&pdev->dev, "failed to get IO address\n");