Re: [PATCH 04/12] nvmem: qfprom: fix different address space warnings of sparse
From: Greg KH
Date: Fri Oct 20 2017 - 09:34:34 EST
On Mon, Oct 09, 2017 at 03:26:33PM +0200, srinivas.kandagatla@xxxxxxxxxx wrote:
> From: Masahiro Yamada <yamada.masahiro@xxxxxxxxxxxxx>
>
> Fix the following sparse warnings:
>
> drivers/nvmem/qfprom.c:23:30: warning: incorrect type in initializer (different address spaces)
> drivers/nvmem/qfprom.c:23:30: expected void [noderef] <asn:2>*base
> drivers/nvmem/qfprom.c:23:30: got void *context
> drivers/nvmem/qfprom.c:36:30: warning: incorrect type in initializer (different address spaces)
> drivers/nvmem/qfprom.c:36:30: expected void [noderef] <asn:2>*base
> drivers/nvmem/qfprom.c:36:30: got void *context
> drivers/nvmem/qfprom.c:76:22: warning: incorrect type in assignment (different address spaces)
> drivers/nvmem/qfprom.c:76:22: expected void *static [toplevel] [assigned] priv
> drivers/nvmem/qfprom.c:76:22: got void [noderef] <asn:2>*[assigned] base
>
> The type of nvmem_config->priv is (void *), so sparse complains
> about assignment of the base address with (void __iomem *) type.
>
> Even if we cast it out, sparse still warns:
> warning: cast removes address space of expression
>
> Of course, we can shut up the sparse by marking __force, but a more
> correct way is to put the base address into driver private data.
Same objection here. Don't hide things like this.
greg k-h