2020-11-14 09:15:17

by Zou Wei

[permalink] [raw]
Subject: [PATCH -next] mfd: altera-sysmgr: Use resource_size function on resource object

./drivers/mfd/altera-sysmgr.c:155:36-39: WARNING: Suspicious code. resource_size is maybe missing with res

Generated by: scripts/coccinelle/api/resource_size.cocci

Signed-off-by: Zou Wei <[email protected]>
---
drivers/mfd/altera-sysmgr.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mfd/altera-sysmgr.c b/drivers/mfd/altera-sysmgr.c
index 41076d1..193a96c 100644
--- a/drivers/mfd/altera-sysmgr.c
+++ b/drivers/mfd/altera-sysmgr.c
@@ -152,7 +152,7 @@ static int sysmgr_probe(struct platform_device *pdev)
if (!base)
return -ENOMEM;

- sysmgr_config.max_register = res->end - res->start - 3;
+ sysmgr_config.max_register = resource_size(res) - 3;
regmap = devm_regmap_init_mmio(dev, base, &sysmgr_config);
}

--
2.6.2


2020-11-27 08:52:43

by Lee Jones

[permalink] [raw]
Subject: Re: [PATCH -next] mfd: altera-sysmgr: Use resource_size function on resource object

On Sat, 14 Nov 2020, Zou Wei wrote:

> ./drivers/mfd/altera-sysmgr.c:155:36-39: WARNING: Suspicious code. resource_size is maybe missing with res
>
> Generated by: scripts/coccinelle/api/resource_size.cocci
>
> Signed-off-by: Zou Wei <[email protected]>
> ---
> drivers/mfd/altera-sysmgr.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)

Applied, thanks.

--
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog