spi: mxs: use devm_platform_ioremap_resource() to simplify code
authorYueHaibing <yuehaibing@huawei.com>
Wed, 4 Sep 2019 13:59:00 +0000 (21:59 +0800)
committerMark Brown <broonie@kernel.org>
Wed, 4 Sep 2019 16:19:54 +0000 (17:19 +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-19-yuehaibing@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-mxs.c

index 7bf53cfc25d6323681b356069aadc9f5b9750103..996c1c8a9c719e77372c0358025eaa7ed193d232 100644 (file)
@@ -532,7 +532,6 @@ static int mxs_spi_probe(struct platform_device *pdev)
        struct spi_master *master;
        struct mxs_spi *spi;
        struct mxs_ssp *ssp;
-       struct resource *iores;
        struct clk *clk;
        void __iomem *base;
        int devid, clk_freq;
@@ -545,12 +544,11 @@ static int mxs_spi_probe(struct platform_device *pdev)
         */
        const int clk_freq_default = 160000000;
 
-       iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
        irq_err = platform_get_irq(pdev, 0);
        if (irq_err < 0)
                return irq_err;
 
-       base = devm_ioremap_resource(&pdev->dev, iores);
+       base = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(base))
                return PTR_ERR(base);