mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thor Thayer <thor.thayer@linux.intel.com>
To: Arnd Bergmann <arnd@arndb.de>, Borislav Petkov <bp@alien8.de>,
	Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: David Frey <dpfrey@gmail.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Ingo Molnar <mingo@kernel.org>,
	Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
	linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] EDAC, altera: work around int-to-pointer-cast warnings
Date: Thu, 27 Sep 2018 12:23:05 -0500	[thread overview]
Message-ID: <2d52e197-8ce0-e428-fb1a-e118a840fa12@linux.intel.com> (raw)
In-Reply-To: <20180927100949.973078-1-arnd@arndb.de>

Hi Arnd,

On 09/27/2018 05:09 AM, Arnd Bergmann wrote:
> 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: d5fc9125566c ("EDAC, altera: Combine Stratix10 and Arria10 probe functions")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>   drivers/edac/altera_edac.c | 13 +++++++------
>   1 file changed, 7 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/edac/altera_edac.c b/drivers/edac/altera_edac.c
> index 0e9e80789d99..c89d82aa2776 100644
> --- a/drivers/edac/altera_edac.c
> +++ b/drivers/edac/altera_edac.c
> @@ -1036,7 +1036,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);
> @@ -1050,9 +1050,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);
> @@ -2045,7 +2045,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);
> @@ -2059,9 +2059,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);
>   	}
>   
Thanks for the fix.

Reviewed-by: Thor Thayer <thor.thayer@linux.intel.com>


  reply	other threads:[~2018-09-27 17:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-27 10:09 Arnd Bergmann
2018-09-27 17:23 ` Thor Thayer [this message]
2018-09-28  8:16 ` Borislav Petkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2d52e197-8ce0-e428-fb1a-e118a840fa12@linux.intel.com \
    --to=thor.thayer@linux.intel.com \
    --cc=arnd@arndb.de \
    --cc=bp@alien8.de \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=dpfrey@gmail.com \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mchehab@kernel.org \
    --cc=mingo@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome