linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mfd: altera-sysmgr: Fix a mistake caused by resource_size function
@ 2021-10-06 14:19 Kai Song
  2021-10-18 14:02 ` Lee Jones
  0 siblings, 1 reply; 2+ messages in thread
From: Kai Song @ 2021-10-06 14:19 UTC (permalink / raw)
  To: thor.thayer, lee.jones; +Cc: zou_wei, linux-kernel, Kai Song

Fixes: d12edf9661a4 ("mfd: altera-sysmgr: Use resource_size function on resource object")

The resource_size defines that:
	res->end - res->start + 1;
The origin original code is:
	sysmgr_config.max_register = res->end - res->start - 3;

So, the correct fix is that:
	sysmgr_config.max_register = resource_size(res) - 4;

Signed-off-by: Kai Song <songkai01@inspur.com>
---
 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 20cb294c7512..5d3715a28b28 100644
--- a/drivers/mfd/altera-sysmgr.c
+++ b/drivers/mfd/altera-sysmgr.c
@@ -153,7 +153,7 @@ static int sysmgr_probe(struct platform_device *pdev)
 		if (!base)
 			return -ENOMEM;
 
-		sysmgr_config.max_register = resource_size(res) - 3;
+		sysmgr_config.max_register = resource_size(res) - 4;
 		regmap = devm_regmap_init_mmio(dev, base, &sysmgr_config);
 	}
 
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] mfd: altera-sysmgr: Fix a mistake caused by resource_size function
  2021-10-06 14:19 [PATCH] mfd: altera-sysmgr: Fix a mistake caused by resource_size function Kai Song
@ 2021-10-18 14:02 ` Lee Jones
  0 siblings, 0 replies; 2+ messages in thread
From: Lee Jones @ 2021-10-18 14:02 UTC (permalink / raw)
  To: Kai Song; +Cc: thor.thayer, zou_wei, linux-kernel

On Wed, 06 Oct 2021, Kai Song wrote:

> Fixes: d12edf9661a4 ("mfd: altera-sysmgr: Use resource_size function on resource object")
> 
> The resource_size defines that:
> 	res->end - res->start + 1;
> The origin original code is:
> 	sysmgr_config.max_register = res->end - res->start - 3;
> 
> So, the correct fix is that:
> 	sysmgr_config.max_register = resource_size(res) - 4;
> 
> Signed-off-by: Kai Song <songkai01@inspur.com>
> ---
>  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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-10-18 14:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-06 14:19 [PATCH] mfd: altera-sysmgr: Fix a mistake caused by resource_size function Kai Song
2021-10-18 14:02 ` Lee Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).