Patchwork [U-Boot,02/19] usbdev.c: Fix GCC 4.6 build warnings

login
register
mail settings
Submitter Stefan Roese
Date Nov. 15, 2011, 6:01 p.m.
Message ID <1321380112-6210-1-git-send-email-sr@denx.de>
Download mbox | patch
Permalink /patch/125833/
State Not Applicable
Headers show

Comments

Stefan Roese - Nov. 15, 2011, 6:01 p.m.
Fix:
usbdev.c: In function 'process_endpoints':
usbdev.c:29:12: warning: variable 'temp1' set but not used [-Wunused-but-set-variable]
usbdev.c:29:6: warning: variable 'temp' set but not used [-Wunused-but-set-variable]

Signed-off-by: Stefan Roese <sr@denx.de>
---
 arch/powerpc/cpu/ppc4xx/usbdev.c |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)
Mike Frysinger - Nov. 15, 2011, 11:01 p.m.
On Tuesday 15 November 2011 13:01:52 Stefan Roese wrote:
> --- a/arch/powerpc/cpu/ppc4xx/usbdev.c
> +++ b/arch/powerpc/cpu/ppc4xx/usbdev.c
>
> -	int temp, temp1;
> ...
>  		/*copy packet */
>  		setup_packet_pt[0] = *(unsigned int *)USB2D0_FIFO_0;
>  		setup_packet_pt[1] = *(unsigned int *)USB2D0_FIFO_0;
> -		temp = *(unsigned int *)USB2D0_FIFO_0;
> -		temp1 = *(unsigned int *)USB2D0_FIFO_0;

this seems to be treading into possible ugly volatile area ... perhaps best if 
this was acked/tested by someone with actual hardware first ...
-mike
Marek Vasut - Nov. 16, 2011, 2:26 a.m.
> On Tuesday 15 November 2011 13:01:52 Stefan Roese wrote:
> > --- a/arch/powerpc/cpu/ppc4xx/usbdev.c
> > +++ b/arch/powerpc/cpu/ppc4xx/usbdev.c
> > 
> > -	int temp, temp1;
> > ...
> > 
> >  		/*copy packet */
> >  		setup_packet_pt[0] = *(unsigned int *)USB2D0_FIFO_0;
> >  		setup_packet_pt[1] = *(unsigned int *)USB2D0_FIFO_0;
> > 
> > -		temp = *(unsigned int *)USB2D0_FIFO_0;
> > -		temp1 = *(unsigned int *)USB2D0_FIFO_0;
> 
> this seems to be treading into possible ugly volatile area ... perhaps best
> if this was acked/tested by someone with actual hardware first ...
> -mike

My words definitelly ... maybe replace with in_be32() ? It seems very 
suspicious, as if there was a reason for this access. Like you need to do more 
accesses to the fifo to clean up some trailing crud.

M
Wolfgang Denk - Dec. 9, 2011, 9:31 a.m.
Dear Stefan Roese,

In message <1321380112-6210-1-git-send-email-sr@denx.de> you wrote:
> Fix:
> usbdev.c: In function 'process_endpoints':
> usbdev.c:29:12: warning: variable 'temp1' set but not used [-Wunused-but-set-variable]
> usbdev.c:29:6: warning: variable 'temp' set but not used [-Wunused-but-set-variable]
> 
> Signed-off-by: Stefan Roese <sr@denx.de>
...
> @@ -44,8 +43,6 @@ void process_endpoints(unsigned short usb2d0_intrin)
>  		/*copy packet */
>  		setup_packet_pt[0] = *(unsigned int *)USB2D0_FIFO_0;
>  		setup_packet_pt[1] = *(unsigned int *)USB2D0_FIFO_0;
> -		temp = *(unsigned int *)USB2D0_FIFO_0;
> -		temp1 = *(unsigned int *)USB2D0_FIFO_0;

It seems we agree that these reads from the FIFO registers may
actually be important for proper operation. Are you planning to
submit an updated, improved patch?

Best regards,

Wolfgang Denk
Stefan Roese - Dec. 9, 2011, 9:44 a.m.
Hi Wolfgang,

On Friday 09 December 2011 10:31:01 Wolfgang Denk wrote:
> In message <1321380112-6210-1-git-send-email-sr@denx.de> you wrote:
> > Fix:
> > usbdev.c: In function 'process_endpoints':
> > usbdev.c:29:12: warning: variable 'temp1' set but not used
> > [-Wunused-but-set-variable] usbdev.c:29:6: warning: variable 'temp' set
> > but not used [-Wunused-but-set-variable]
> > 
> > Signed-off-by: Stefan Roese <sr@denx.de>
> 
> ...
> 
> > @@ -44,8 +43,6 @@ void process_endpoints(unsigned short usb2d0_intrin)
> > 
> >  		/*copy packet */
> >  		setup_packet_pt[0] = *(unsigned int *)USB2D0_FIFO_0;
> >  		setup_packet_pt[1] = *(unsigned int *)USB2D0_FIFO_0;
> > 
> > -		temp = *(unsigned int *)USB2D0_FIFO_0;
> > -		temp1 = *(unsigned int *)USB2D0_FIFO_0;
> 
> It seems we agree that these reads from the FIFO registers may
> actually be important for proper operation. Are you planning to
> submit an updated, improved patch?

This file has been removed with patch ce2acd371c4eee36e55d706a181361c25ebfe160 
already in mainline.

Best regards,
Stefan

--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office@denx.de
Wolfgang Denk - Dec. 9, 2011, 11:18 a.m.
Dear Stefan Roese,

In message <201112091044.03681.sr@denx.de> you wrote:
> 
> This file has been removed with patch ce2acd371c4eee36e55d706a181361c25ebfe160 
> already in mainline.

Ah, right.  Even better :-)

Thanks.

Best regards,

Wolfgang Denk

Patch

diff --git a/arch/powerpc/cpu/ppc4xx/usbdev.c b/arch/powerpc/cpu/ppc4xx/usbdev.c
index fe398af..fc7da89 100644
--- a/arch/powerpc/cpu/ppc4xx/usbdev.c
+++ b/arch/powerpc/cpu/ppc4xx/usbdev.c
@@ -26,7 +26,6 @@  void process_endpoints(unsigned short usb2d0_intrin)
 	struct devrequest setup_packet;
 	unsigned int *setup_packet_pt;
 	unsigned char *packet_pt = NULL;
-	int temp, temp1;
 
 	int i;
 
@@ -44,8 +43,6 @@  void process_endpoints(unsigned short usb2d0_intrin)
 		/*copy packet */
 		setup_packet_pt[0] = *(unsigned int *)USB2D0_FIFO_0;
 		setup_packet_pt[1] = *(unsigned int *)USB2D0_FIFO_0;
-		temp = *(unsigned int *)USB2D0_FIFO_0;
-		temp1 = *(unsigned int *)USB2D0_FIFO_0;
 
 		/*do some swapping */
 		setup_packet.value = swap_16(setup_packet.value);