Re: [PATCH 223/260] usb: gadget: renesas_usbhs: fix compile warning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Wed, Oct 26, 2011 at 12:45:59AM -0700, kuninori.morimoto.gx@xxxxxxxxxxx wrote:
> Hi Felipe, Paul
> 
> > > From: Felipe Balbi <balbi <at> ti.com>
> > > 
> > > | drivers/usb/renesas_usbhs/fifo.c: In function ‘usbhsf_dma_prepare_push’:
> > > | drivers/usb/renesas_usbhs/fifo.c:823:7: warning: cast from pointer \
> > > 	to integer of different size [-Wpointer-to-int-cast]
> > > | drivers/usb/renesas_usbhs/fifo.c: In function ‘usbhsf_dma_try_pop’:
> > > | drivers/usb/renesas_usbhs/fifo.c:900:7: warning: cast from pointer \
> > > 	to integer of different size [-Wpointer-to-int-cast]
> > > 
> > > Signed-off-by: Felipe Balbi <balbi <at> ti.com>
> (snip)
> > > @@ -897,7 +897,7 @@ static int usbhsf_dma_try_pop(struct usbhs_pkt *pkt, int *is_done)
> > >  	if (!fifo)
> > >  		goto usbhsf_pio_prepare_pop;
> > > 
> > > -	if (((u32)pkt->buf + pkt->actual) & 0x7) /* 8byte alignment */
> > > +	if ((*(u32 *) pkt->buf + pkt->actual) & 0x7) /* 8byte alignment */
> > >  		goto usbhsf_pio_prepare_pop;
> > > 
> > >  	ret = usbhsf_fifo_select(pipe, fifo, 0);
> > 
> > As pointed out by Sergei, this is pretty obviously a bogus conversion. I
> > think this one should be reverted.
> 
> I guess above warning came from 64bit compiler ?
> My environment is still 32bit, so I didn't noticed this cast issue.
> But is below patch solve this warning/bug ?
> (I'm not good at 64bit)
> 
> ------------------------------
> diff --git a/drivers/usb/renesas_usbhs/fifo.c b/drivers/usb/renesas_usbhs/fifo.c
> index 762b742..6927b8f 100644
> --- a/drivers/usb/renesas_usbhs/fifo.c
> +++ b/drivers/usb/renesas_usbhs/fifo.c
> @@ -820,7 +820,7 @@ static int usbhsf_dma_prepare_push(struct usbhs_pkt *pkt, in
>         if (len % 4) /* 32bit alignment */
>                 goto usbhsf_pio_prepare_push;
>  
> -       if ((*(u32 *) pkt->buf + pkt->actual) & 0x7) /* 8byte alignment */
> +       if ((uintptr_t)(pkt->buf + pkt->actual) & 0x7) /* 8byte alignment */
>                 goto usbhsf_pio_prepare_push;
>  
>         /* get enable DMA fifo */
> @@ -897,7 +897,7 @@ static int usbhsf_dma_try_pop(struct usbhs_pkt *pkt, int *is
>         if (!fifo)
>                 goto usbhsf_pio_prepare_pop;
>  
> -       if ((*(u32 *) pkt->buf + pkt->actual) & 0x7) /* 8byte alignment */
> +       if ((uintptr_t)(pkt->buf + pkt->actual) & 0x7) /* 8byte alignment */
>                 goto usbhsf_pio_prepare_pop;
>  
>         ret = usbhsf_fifo_select(pipe, fifo, 0);
> ------------------------------

Yes it does. Can you send a formal patch ?

Also, can you fix this Section Mismatches, while at that (as a separate
patch, please. But I didn't need to mention that ;-) ?

WARNING: drivers/usb/renesas_usbhs/renesas_usbhs.o(.text+0xf5d): Section
mismatch in reference from the function usbhs_mod_probe() to the
function .devinit.text:usbhs_mod_host_probe()
The function usbhs_mod_probe() references
the function __devinit usbhs_mod_host_probe().
This is often because usbhs_mod_probe lacks a __devinit 
annotation or the annotation of usbhs_mod_host_probe is wrong.

WARNING: drivers/usb/renesas_usbhs/renesas_usbhs.o(.text+0xfd7): Section
mismatch in reference from the function usbhs_mod_probe() to the
function .devexit.text:usbhs_mod_host_remove()
The function usbhs_mod_probe() references a function in an exit section.
Often the function usbhs_mod_host_remove() has valid usage outside the
exit section
and the fix is to remove the __devexit annotation of
usbhs_mod_host_remove.

WARNING: drivers/usb/renesas_usbhs/renesas_usbhs.o(.text+0x1005):
Section mismatch in reference from the function usbhs_mod_remove() to
the function .devexit.text:usbhs_mod_host_remove()
The function usbhs_mod_remove() references a function in an exit
section.
Often the function usbhs_mod_host_remove() has valid usage outside the
exit section
and the fix is to remove the __devexit annotation of
usbhs_mod_host_remove.

-- 
balbi

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux