mfd: altera-sysmgr: Fix a mistake caused by resource_size conversion
authorKai Song <songkai01@inspur.com>
Wed, 6 Oct 2021 14:19:26 +0000 (22:19 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 18 Nov 2021 18:17:09 +0000 (19:17 +0100)
[ Upstream commit fae2570d629cdd72f0611d015fc4ba705ae5422b ]

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;

Fixes: d12edf9661a4 ("mfd: altera-sysmgr: Use resource_size function on resource object")
Signed-off-by: Kai Song <songkai01@inspur.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20211006141926.6120-1-songkai01@inspur.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/mfd/altera-sysmgr.c

index 20cb294c75122db7e195f01878d8d73c00b713a8..5d3715a28b28e2fd3067f34ab2e69999350b4b19 100644 (file)
@@ -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);
        }