hwmon: (aspeed-pwm-tacho) Use devm_platform_ioremap_resource() in aspeed_pwm_tacho_pr...
authorMarkus Elfring <elfring@users.sourceforge.net>
Wed, 18 Sep 2019 08:12:31 +0000 (10:12 +0200)
committerGuenter Roeck <linux@roeck-us.net>
Wed, 6 Nov 2019 22:37:18 +0000 (14:37 -0800)
Simplify this function implementation by using a known wrapper function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Link: https://lore.kernel.org/r/cd5bab7b-9333-2a43-bcf0-a47bbbe719eb@web.de
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/aspeed-pwm-tacho.c

index 40c489be62eaabe3d8ec040a1705d5f527239864..33fb54845bf6ddf1c90c12de7e41bf309917cb73 100644 (file)
@@ -891,17 +891,12 @@ static int aspeed_pwm_tacho_probe(struct platform_device *pdev)
        struct device_node *np, *child;
        struct aspeed_pwm_tacho_data *priv;
        void __iomem *regs;
-       struct resource *res;
        struct device *hwmon;
        struct clk *clk;
        int ret;
 
        np = dev->of_node;
-
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       if (!res)
-               return -ENOENT;
-       regs = devm_ioremap_resource(dev, res);
+       regs = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(regs))
                return PTR_ERR(regs);
        priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);