hwmon: (aspeed-pwm-tacho) Use devm_platform_ioremap_resource() in aspeed_pwm_tacho_probe()
Subsystems (3)
PATCH 1/1 hwmon: (aspeed-pwm-tacho) Use devm_platform_ioremap_resource() in aspeed_pwm_tacho_probe()
From: Markus Elfring <[email protected]>
Date: Wed, 18 Sep 2019 10:12:31 +0200
Simplify this function implementation by using a known wrapper function.
This issue was detected by using the Coccinelle software.
Signed-off-by Markus Elfring <[email protected]>
--- drivers/hwmon/aspeed-pwm-tacho.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/hwmon/aspeed-pwm-tacho.c +1 -6
@@ -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 );
--
2.23.0
Quoted 8 lines · Markus Elfring
From: Markus Elfring <[email protected]>
Date: Wed, 18 Sep 2019 10:12:31 +0200Simplify this function implementation by using a known wrapper function.
This issue was detected by using the Coccinelle software.
Signed-off-by Markus Elfring <[email protected]>
Applied to hwmon-next.
Thanks,
Guenter
Quoted 30 lines
--- drivers/hwmon/aspeed-pwm-tacho.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)--
2.23.0drivers/hwmon/aspeed-pwm-tacho.c +1
-6@@ -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 );