* [PATCH] edac: Make use of the helper function devm_platform_ioremap_resource()
@ 2022-04-21 8:46 cgel.zte
2022-04-21 9:00 ` Jan Lübbe
2022-04-29 9:20 ` Borislav Petkov
0 siblings, 2 replies; 3+ messages in thread
From: cgel.zte @ 2022-04-21 8:46 UTC (permalink / raw)
To: jlu, bp, mchehab
Cc: tony.luck, james.morse, rric, linux-edac, linux-kernel, Lv Ruyi,
Zeal Robot
From: Lv Ruyi <lv.ruyi@zte.com.cn>
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>
---
drivers/edac/armada_xp_edac.c | 18 ++----------------
1 file changed, 2 insertions(+), 16 deletions(-)
diff --git a/drivers/edac/armada_xp_edac.c b/drivers/edac/armada_xp_edac.c
index b1f46a974b9e..038abbb83f4b 100644
--- a/drivers/edac/armada_xp_edac.c
+++ b/drivers/edac/armada_xp_edac.c
@@ -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);
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] edac: Make use of the helper function devm_platform_ioremap_resource()
2022-04-21 8:46 [PATCH] edac: Make use of the helper function devm_platform_ioremap_resource() cgel.zte
@ 2022-04-21 9:00 ` Jan Lübbe
2022-04-29 9:20 ` Borislav Petkov
1 sibling, 0 replies; 3+ messages in thread
From: Jan Lübbe @ 2022-04-21 9:00 UTC (permalink / raw)
To: cgel.zte, bp, mchehab
Cc: tony.luck, james.morse, rric, linux-edac, linux-kernel, Lv Ruyi,
Zeal Robot
On Thu, 2022-04-21 at 08:46 +0000, cgel.zte@gmail.com wrote:
> From: Lv Ruyi <lv.ruyi@zte.com.cn>
>
> 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>
Reviewed-by: Jan Luebbe <jlu@pengutronix.de>
Thanks,
Jan
> ---
> drivers/edac/armada_xp_edac.c | 18 ++----------------
> 1 file changed, 2 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/edac/armada_xp_edac.c b/drivers/edac/armada_xp_edac.c
> index b1f46a974b9e..038abbb83f4b 100644
> --- a/drivers/edac/armada_xp_edac.c
> +++ b/drivers/edac/armada_xp_edac.c
> @@ -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);
--
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 |
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] edac: Make use of the helper function devm_platform_ioremap_resource()
2022-04-21 8:46 [PATCH] edac: Make use of the helper function devm_platform_ioremap_resource() cgel.zte
2022-04-21 9:00 ` Jan Lübbe
@ 2022-04-29 9:20 ` Borislav Petkov
1 sibling, 0 replies; 3+ messages in thread
From: Borislav Petkov @ 2022-04-29 9:20 UTC (permalink / raw)
To: cgel.zte
Cc: jlu, mchehab, tony.luck, james.morse, rric, linux-edac,
linux-kernel, Lv Ruyi, Zeal Robot
On Thu, Apr 21, 2022 at 08:46:21AM +0000, cgel.zte@gmail.com wrote:
> From: Lv Ruyi <lv.ruyi@zte.com.cn>
>
> 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>
> ---
> drivers/edac/armada_xp_edac.c | 18 ++----------------
> 1 file changed, 2 insertions(+), 16 deletions(-)
Applied, thanks.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-04-29 9:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-21 8:46 [PATCH] edac: Make use of the helper function devm_platform_ioremap_resource() cgel.zte
2022-04-21 9:00 ` Jan Lübbe
2022-04-29 9:20 ` Borislav Petkov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox