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: d5fc912556 ("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
This commit is contained in:
Arnd Bergmann 2018-09-27 12:09:26 +02:00 коммит произвёл Borislav Petkov
Родитель c4a3e94641
Коммит 8537bf1097
1 изменённых файлов: 7 добавлений и 6 удалений

Просмотреть файл

@ -1035,7 +1035,7 @@ altr_init_a10_ecc_block(struct device_node *np, u32 irq_mask,
} else {
struct device_node *sysmgr_np;
struct resource res;
void __iomem *base;
uintptr_t base;
sysmgr_np = of_parse_phandle(np_eccmgr,
"altr,sysmgr-syscon", 0);
@ -1049,9 +1049,9 @@ altr_init_a10_ecc_block(struct device_node *np, u32 irq_mask,
return -ENOMEM;
/* Need physical address for SMCC call */
base = (void __iomem *)res.start;
base = res.start;
ecc_mgr_map = regmap_init(NULL, NULL, base,
ecc_mgr_map = regmap_init(NULL, NULL, (void *)base,
&s10_sdram_regmap_cfg);
}
of_node_put(np_eccmgr);
@ -2044,7 +2044,7 @@ static int altr_edac_a10_probe(struct platform_device *pdev)
} else {
struct device_node *sysmgr_np;
struct resource res;
void __iomem *base;
uintptr_t base;
sysmgr_np = of_parse_phandle(pdev->dev.of_node,
"altr,sysmgr-syscon", 0);
@ -2058,9 +2058,10 @@ static int altr_edac_a10_probe(struct platform_device *pdev)
return -ENOMEM;
/* Need physical address for SMCC call */
base = (void __iomem *)res.start;
base = res.start;
edac->ecc_mgr_map = devm_regmap_init(&pdev->dev, NULL, base,
edac->ecc_mgr_map = devm_regmap_init(&pdev->dev, NULL,
(void *)base,
&s10_sdram_regmap_cfg);
}