edac: Make use of the helper function devm_platform_ioremap_resource()
Subsystems (2)
PATCH 1/1 edac: Make use of the helper function devm_platform_ioremap_resource()
From: Lv Ruyi <[email protected]>
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 <[email protected]>
Signed-off-by Lv Ruyi <[email protected]>
--- drivers/edac/armada_xp_edac.c | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-)
drivers/edac/armada_xp_edac.c +2 -16
@@ -286,17 +286,10 @@ static int axp_mc_probe(struct platform_device *pdev)struct edac_mc_layer layers[1 ];const struct of_device_id *id;struct mem_ctl_info *mci; -struct resource *r;void __iomem *base;uint32_t config; - r =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); -if (!r) { -dev_err (&pdev->dev,"Unable to get mem resource\n" ); -return -ENODEV ; - } - - base =devm_ioremap_resource (&pdev->dev, r); + base =devm_platform_ioremap_resource (pdev,0 );if (IS_ERR (base)) {dev_err (&pdev->dev,"Unable to map regs\n" );return PTR_ERR (base);
@@ -516,15 +509,8 @@ static int aurora_l2_probe(struct platform_device *pdev)const struct of_device_id *id;uint32_t l2x0_aux_ctrl;void __iomem *base; -struct resource *r; - - r =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); -if (!r) { -dev_err (&pdev->dev,"Unable to get mem resource\n" ); -return -ENODEV ; - } - base =devm_ioremap_resource (&pdev->dev, r); + base =devm_platform_ioremap_resource (pdev,0 );if (IS_ERR (base)) {dev_err (&pdev->dev,"Unable to map regs\n" );return PTR_ERR (base);
Signature · 1 line
2.25.1
Quoted 8 lines · On Thu, 2022-04-21 at 08:46 +0000, [email protected] wrote:
From: Lv Ruyi <[email protected]>
Use the
devm_platform_ioremap_resource()helper instead of callingplatform_get_resource()anddevm_ioremap_resource()separately.Make the code simpler without functional changes.Reported-by Zeal Robot <[email protected]>Signed-off-by Lv Ruyi <[email protected]>
Reviewed-by Jan Luebbe <[email protected]>
Thanks,
Jan
Quoted 44 lines
--- drivers/edac/armada_xp_edac.c | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-)drivers/edac/armada_xp_edac.c +2
-16@@ -286,17 +286,10 @@ static int axp_mc_probe(struct platform_device *pdev)struct edac_mc_layer layers[1 ];const struct of_device_id *id;struct mem_ctl_info *mci; -struct resource *r;void __iomem *base;uint32_t config; - r =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); -if (!r) { -dev_err (&pdev->dev,"Unable to get mem resource\n" ); -return -ENODEV ; - } - - base =devm_ioremap_resource (&pdev->dev, r); + base =devm_platform_ioremap_resource (pdev,0 );if (IS_ERR (base)) {dev_err (&pdev->dev,"Unable to map regs\n" );return PTR_ERR (base);@@ -516,15 +509,8 @@ static int aurora_l2_probe(struct platform_device *pdev)const struct of_device_id *id;uint32_t l2x0_aux_ctrl;void __iomem *base; -struct resource *r; - - r =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); -if (!r) { -dev_err (&pdev->dev,"Unable to get mem resource\n" ); -return -ENODEV ; - } - base =devm_ioremap_resource (&pdev->dev, r); + base =devm_platform_ioremap_resource (pdev,0 );if (IS_ERR (base)) {dev_err (&pdev->dev,"Unable to map regs\n" );return PTR_ERR (base);
Signature · 4 lines
Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Quoted 11 lines · On Thu, Apr 21, 2022 at 08:46:21AM +0000, [email protected] wrote:
From: Lv Ruyi <[email protected]>
Use the
devm_platform_ioremap_resource()helper instead of callingplatform_get_resource()anddevm_ioremap_resource()separately.Make the code simpler without functional changes.Reported-by Zeal Robot <[email protected]>Signed-off-by Lv Ruyi <[email protected]>--- drivers/edac/armada_xp_edac.c | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-)
Applied, thanks.
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette