[PATCH] [POWERPC] ucc_geth: Eliminate compile warnings

Medve Emilian-EMMEDVE1 Emilian.Medve at freescale.com
Fri Oct 19 23:39:12 EST 2007


Hello David


> It only kills the warning on 32-bit systems, the cast is wrong
> either way.

I'm not aware of the QE being present on any 64-bit PowerPC. However,
porting the entire driver to a 64-bit platform is an exercise in itself
as many other things would need tweaking the QE hardware itself. But
that's an orthogonal issue. For now I just want to fix that warning.

> 
> >  			ugeth->tx_bd_ring_offset[j] =
> > -				kmalloc((u32) (length + align), 
> GFP_KERNEL);
> > +				(u32)kmalloc(length + align, 
> GFP_KERNEL);
> >  
> >  			if (ugeth->tx_bd_ring_offset[j] != 0)
> >  				ugeth->p_tx_bd_ring[j] =
> 
> Pointers can be up to "unsigned long" in size, therefore that
> is the minimal amount of storage you need to store them into
> if they are needed in integer form for some reason.
> 
> Any cast from pointer to integer like this is a huge red flag.

Agreed, but again, I'm not trying to fix the entire driver or to port it
to a different architecture.

For the current situation, 32-bit QE, 32-bit PowerPC, do you find the
patch acceptable?


Cheers,
Emil.



More information about the Linuxppc-dev mailing list