* [PATCH] mfd: altera-sysmgr: Fix physical address storing more
@ 2020-12-03 22:52 Arnd Bergmann
2020-12-16 8:46 ` Lee Jones
0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2020-12-03 22:52 UTC (permalink / raw)
To: Thor Thayer, Lee Jones; +Cc: Arnd Bergmann, linux-kernel
From: Arnd Bergmann <arnd@arndb.de>
A recent fix improved the way the resource gets passed to
the low-level accessors, but left one warning that appears
in configurations with a resource_size_t that is wider than
a pointer:
In file included from drivers/mfd/altera-sysmgr.c:19:
drivers/mfd/altera-sysmgr.c: In function 'sysmgr_probe':
drivers/mfd/altera-sysmgr.c:148:40: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
148 | regmap = devm_regmap_init(dev, NULL, (void *)res->start,
| ^
include/linux/regmap.h:646:6: note: in definition of macro '__regmap_lockdep_wrapper'
646 | fn(__VA_ARGS__, &_key, \
| ^~~~~~~~~~~
drivers/mfd/altera-sysmgr.c:148:12: note: in expansion of macro 'devm_regmap_init'
148 | regmap = devm_regmap_init(dev, NULL, (void *)res->start,
| ^~~~~~~~~~~~~~~~
I had tried a different approach that would store the address
in the private data as a phys_addr_t, but the easiest solution
now seems to be to add a double cast to shut up the warning.
As the address is passed to an inline assembly, it is guaranteed
to not be wider than a register anyway.
Fixes: d9ca7801b6e5 ("mfd: altera-sysmgr: Fix physical address storing hacks")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/mfd/altera-sysmgr.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/mfd/altera-sysmgr.c b/drivers/mfd/altera-sysmgr.c
index 41076d121dd5..591b300d9095 100644
--- a/drivers/mfd/altera-sysmgr.c
+++ b/drivers/mfd/altera-sysmgr.c
@@ -145,7 +145,8 @@ static int sysmgr_probe(struct platform_device *pdev)
sysmgr_config.reg_write = s10_protected_reg_write;
/* Need physical address for SMCC call */
- regmap = devm_regmap_init(dev, NULL, (void *)res->start,
+ regmap = devm_regmap_init(dev, NULL,
+ (void *)(uintptr_t)res->start,
&sysmgr_config);
} else {
base = devm_ioremap(dev, res->start, resource_size(res));
--
2.27.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] mfd: altera-sysmgr: Fix physical address storing more
2020-12-03 22:52 [PATCH] mfd: altera-sysmgr: Fix physical address storing more Arnd Bergmann
@ 2020-12-16 8:46 ` Lee Jones
0 siblings, 0 replies; 2+ messages in thread
From: Lee Jones @ 2020-12-16 8:46 UTC (permalink / raw)
To: Arnd Bergmann; +Cc: Thor Thayer, Arnd Bergmann, linux-kernel
On Thu, 03 Dec 2020, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> A recent fix improved the way the resource gets passed to
> the low-level accessors, but left one warning that appears
> in configurations with a resource_size_t that is wider than
> a pointer:
>
> In file included from drivers/mfd/altera-sysmgr.c:19:
> drivers/mfd/altera-sysmgr.c: In function 'sysmgr_probe':
> drivers/mfd/altera-sysmgr.c:148:40: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
> 148 | regmap = devm_regmap_init(dev, NULL, (void *)res->start,
> | ^
> include/linux/regmap.h:646:6: note: in definition of macro '__regmap_lockdep_wrapper'
> 646 | fn(__VA_ARGS__, &_key, \
> | ^~~~~~~~~~~
> drivers/mfd/altera-sysmgr.c:148:12: note: in expansion of macro 'devm_regmap_init'
> 148 | regmap = devm_regmap_init(dev, NULL, (void *)res->start,
> | ^~~~~~~~~~~~~~~~
>
> I had tried a different approach that would store the address
> in the private data as a phys_addr_t, but the easiest solution
> now seems to be to add a double cast to shut up the warning.
>
> As the address is passed to an inline assembly, it is guaranteed
> to not be wider than a register anyway.
>
> Fixes: d9ca7801b6e5 ("mfd: altera-sysmgr: Fix physical address storing hacks")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> drivers/mfd/altera-sysmgr.c | 3 ++-
> 1 file changed, 2 insertions(+), 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:[~2020-12-16 8:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-03 22:52 [PATCH] mfd: altera-sysmgr: Fix physical address storing more Arnd Bergmann
2020-12-16 8:46 ` 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).