ata: Make use of the helper function devm_platform_ioremap_resource()
authorLv Ruyi <lv.ruyi@zte.com.cn>
Thu, 21 Apr 2022 08:44:12 +0000 (08:44 +0000)
committerDamien Le Moal <damien.lemoal@opensource.wdc.com>
Thu, 21 Apr 2022 23:38:18 +0000 (08:38 +0900)
Use the devm_platform_ioremap_resource() helper instead of calling
platform_get_resource() and devm_ioremap_resource() separately.Make the
code simpler without functional changes.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Lv Ruyi <lv.ruyi@zte.com.cn>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
drivers/ata/sata_gemini.c

index 00e1c79..b729e99 100644 (file)
@@ -318,7 +318,6 @@ static int gemini_sata_probe(struct platform_device *pdev)
        struct device_node *np = dev->of_node;
        struct sata_gemini *sg;
        struct regmap *map;
-       struct resource *res;
        enum gemini_muxmode muxmode;
        u32 gmode;
        u32 gmask;
@@ -329,11 +328,7 @@ static int gemini_sata_probe(struct platform_device *pdev)
                return -ENOMEM;
        sg->dev = dev;
 
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       if (!res)
-               return -ENODEV;
-
-       sg->base = devm_ioremap_resource(dev, res);
+       sg->base = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(sg->base))
                return PTR_ERR(sg->base);