Skip to content

Commit 8537bf1

Browse files
arndbsuryasaimadhu
authored andcommitted
EDAC, altera: Work around int-to-pointer-cast warnings
The altera edac driver passes a token from a DT resource as resource_size_t into an SMC call, but casts it to an __iomem pointer and then a plain void pointer inbetween, mixing three or four incompatible types in the process. The compiler complains about one of the conversions: drivers/edac/altera_edac.c: In function 'altr_init_a10_ecc_block': drivers/edac/altera_edac.c:1053:10: error: cast to pointer from integer of \ different size [-Werror=int-to-pointer-cast] base = (void __iomem *)res.start; ^ drivers/edac/altera_edac.c: In function 'altr_edac_a10_probe': drivers/edac/altera_edac.c:2062:10: error: cast to pointer from integer of \ different size [-Werror=int-to-pointer-cast] base = (void __iomem *)res.start; Using a static checker probably also notices the __iomem cast. Solving this properly isn't trivial, but simply casting to a 'uintptr_t' instead of 'void __iomem *' makes it less wrong and should avoid the warnings. Fixes: d5fc912 ("EDAC, altera: Combine Stratix10 and Arria10 probe functions") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Borislav Petkov <bp@suse.de> Reviewed-by: Thor Thayer <thor.thayer@linux.intel.com> Cc: Mauro Carvalho Chehab <mchehab@kernel.org> Cc: David Frey <dpfrey@gmail.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Cc: linux-edac@vger.kernel.org Link: https://lkml.kernel.org/r/20180927100949.973078-1-arnd@arndb.de
1 parent c4a3e94 commit 8537bf1

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

drivers/edac/altera_edac.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,7 +1035,7 @@ altr_init_a10_ecc_block(struct device_node *np, u32 irq_mask,
10351035
} else {
10361036
struct device_node *sysmgr_np;
10371037
struct resource res;
1038-
void __iomem *base;
1038+
uintptr_t base;
10391039

10401040
sysmgr_np = of_parse_phandle(np_eccmgr,
10411041
"altr,sysmgr-syscon", 0);
@@ -1049,9 +1049,9 @@ altr_init_a10_ecc_block(struct device_node *np, u32 irq_mask,
10491049
return -ENOMEM;
10501050

10511051
/* Need physical address for SMCC call */
1052-
base = (void __iomem *)res.start;
1052+
base = res.start;
10531053

1054-
ecc_mgr_map = regmap_init(NULL, NULL, base,
1054+
ecc_mgr_map = regmap_init(NULL, NULL, (void *)base,
10551055
&s10_sdram_regmap_cfg);
10561056
}
10571057
of_node_put(np_eccmgr);
@@ -2044,7 +2044,7 @@ static int altr_edac_a10_probe(struct platform_device *pdev)
20442044
} else {
20452045
struct device_node *sysmgr_np;
20462046
struct resource res;
2047-
void __iomem *base;
2047+
uintptr_t base;
20482048

20492049
sysmgr_np = of_parse_phandle(pdev->dev.of_node,
20502050
"altr,sysmgr-syscon", 0);
@@ -2058,9 +2058,10 @@ static int altr_edac_a10_probe(struct platform_device *pdev)
20582058
return -ENOMEM;
20592059

20602060
/* Need physical address for SMCC call */
2061-
base = (void __iomem *)res.start;
2061+
base = res.start;
20622062

2063-
edac->ecc_mgr_map = devm_regmap_init(&pdev->dev, NULL, base,
2063+
edac->ecc_mgr_map = devm_regmap_init(&pdev->dev, NULL,
2064+
(void *)base,
20642065
&s10_sdram_regmap_cfg);
20652066
}
20662067

0 commit comments

Comments
 (0)