[2/3] mtd: atmel nand: fix build warning on 64-bit

Message ID 20180709155730.2422841-2-arnd@arndb.de
State Superseded
Headers show
Series
  • [1/3] mtd: rawnand: davinci: fix build testing on 64-bit
Related show

Commit Message

Arnd Bergmann July 9, 2018, 3:57 p.m.
Build-testing this driver on a 64-bit architecture produces a
harmless warning:

drivers/mtd/nand/raw/atmel/nand-controller.c: In function 'atmel_smc_nand_controller_init':
drivers/mtd/nand/raw/atmel/nand-controller.c:2053:21: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]

To cast the pointer correctly, the destination type should be
uintptr_t rather than a 32-bit int.

Fixes: c2f3d0b913a5 ("mtd: rawnand: atmel: Allow selection of this driver when COMPILE_TEST=y")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/mtd/nand/raw/atmel/nand-controller.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Tudor Ambarus July 13, 2018, 9:56 a.m. | #1
Hi, Arnd,

On 07/09/2018 06:57 PM, Arnd Bergmann wrote:
> +	nc->ebi_csa_offs = (uintptr_t)match->data;

I guess we should declare ebi_csa_offs as size_t, right?

Best,
ta
Arnd Bergmann July 13, 2018, 10:16 a.m. | #2
On Fri, Jul 13, 2018 at 11:56 AM, Tudor Ambarus
<tudor.ambarus@microchip.com> wrote:
> Hi, Arnd,
>
> On 07/09/2018 06:57 PM, Arnd Bergmann wrote:
>> +     nc->ebi_csa_offs = (uintptr_t)match->data;
>
> I guess we should declare ebi_csa_offs as size_t, right?

Yes, that would make sense, though it doesn't change the behavior.

      Arnd
Miquel Raynal July 17, 2018, 9:05 p.m. | #3
Hi Arnd,

Arnd Bergmann <arnd@arndb.de> wrote on Fri, 13 Jul 2018 12:16:09 +0200:

> On Fri, Jul 13, 2018 at 11:56 AM, Tudor Ambarus
> <tudor.ambarus@microchip.com> wrote:
> > Hi, Arnd,
> >
> > On 07/09/2018 06:57 PM, Arnd Bergmann wrote:  
> >> +     nc->ebi_csa_offs = (uintptr_t)match->data;  
> >
> > I guess we should declare ebi_csa_offs as size_t, right?  
> 
> Yes, that would make sense, though it doesn't change the behavior.
> 

Do you plan to send a new version? I don't want to mess with
improvised casts :)

Thanks,
Miquèl
Boris Brezillon July 17, 2018, 9:08 p.m. | #4
On Tue, 17 Jul 2018 23:05:23 +0200
Miquel Raynal <miquel.raynal@bootlin.com> wrote:

> Hi Arnd,
> 
> Arnd Bergmann <arnd@arndb.de> wrote on Fri, 13 Jul 2018 12:16:09 +0200:
> 
> > On Fri, Jul 13, 2018 at 11:56 AM, Tudor Ambarus
> > <tudor.ambarus@microchip.com> wrote:  
> > > Hi, Arnd,
> > >
> > > On 07/09/2018 06:57 PM, Arnd Bergmann wrote:    
> > >> +     nc->ebi_csa_offs = (uintptr_t)match->data;    
> > >
> > > I guess we should declare ebi_csa_offs as size_t, right?    
> > 
> > Yes, that would make sense, though it doesn't change the behavior.
> >   
> 
> Do you plan to send a new version? I don't want to mess with
> improvised casts :)

This fix is already part of my COMPILE_TEST series (v2), and I don't
thing declaring ->ebi_csa_offs as a size_t is useful.
Miquel Raynal July 18, 2018, 6:56 a.m. | #5
Hi Boris,

Boris Brezillon <boris.brezillon@bootlin.com> wrote on Tue, 17 Jul 2018
23:08:39 +0200:

> On Tue, 17 Jul 2018 23:05:23 +0200
> Miquel Raynal <miquel.raynal@bootlin.com> wrote:
> 
> > Hi Arnd,
> > 
> > Arnd Bergmann <arnd@arndb.de> wrote on Fri, 13 Jul 2018 12:16:09 +0200:
> >   
> > > On Fri, Jul 13, 2018 at 11:56 AM, Tudor Ambarus
> > > <tudor.ambarus@microchip.com> wrote:    
> > > > Hi, Arnd,
> > > >
> > > > On 07/09/2018 06:57 PM, Arnd Bergmann wrote:      
> > > >> +     nc->ebi_csa_offs = (uintptr_t)match->data;      
> > > >
> > > > I guess we should declare ebi_csa_offs as size_t, right?      
> > > 
> > > Yes, that would make sense, though it doesn't change the behavior.
> > >     
> > 
> > Do you plan to send a new version? I don't want to mess with
> > improvised casts :)  
> 
> This fix is already part of my COMPILE_TEST series (v2), and I don't
> thing declaring ->ebi_csa_offs as a size_t is useful.

I missed that, ok.

Thanks,
Miquèl

Patch

diff --git a/drivers/mtd/nand/raw/atmel/nand-controller.c b/drivers/mtd/nand/raw/atmel/nand-controller.c
index e686fe73159e..e8f7549d0354 100644
--- a/drivers/mtd/nand/raw/atmel/nand-controller.c
+++ b/drivers/mtd/nand/raw/atmel/nand-controller.c
@@ -2050,7 +2050,7 @@  atmel_smc_nand_controller_init(struct atmel_smc_nand_controller *nc)
 		return ret;
 	}
 
-	nc->ebi_csa_offs = (unsigned int)match->data;
+	nc->ebi_csa_offs = (uintptr_t)match->data;
 
 	/*
 	 * The at91sam9263 has 2 EBIs, if the NAND controller is under EBI1