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

index 11b692923fd7fb99ffbdc359f37c434d16c89b73..86ad17597f5fd8f0a58c827fa68fc05bda920fc9 100644 (file)
@@ -570,7 +570,6 @@ static int pic32_sqi_probe(struct platform_device *pdev)
 {
        struct spi_master *master;
        struct pic32_sqi *sqi;
-       struct resource *reg;
        int ret;
 
        master = spi_alloc_master(&pdev->dev, sizeof(*sqi));
@@ -580,8 +579,7 @@ static int pic32_sqi_probe(struct platform_device *pdev)
        sqi = spi_master_get_devdata(master);
        sqi->master = master;
 
-       reg = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       sqi->regs = devm_ioremap_resource(&pdev->dev, reg);
+       sqi->regs = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(sqi->regs)) {
                ret = PTR_ERR(sqi->regs);
                goto err_free_master;