Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 20 Aug 2008 22:16:18 +0200
From:      Hans Petter Selasky <hselasky@c2i.net>
To:        freebsd-usb@freebsd.org
Cc:        usb@freebsd.org
Subject:   Re: HEADSUP new usb code coming in.
Message-ID:  <200808202216.21060.hselasky@c2i.net>
In-Reply-To: <20080820194807.GE33396@rink.nu>
References:  <20080819194413.GB16977@elvis.mu.org> <20080820194807.GE33396@rink.nu>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi,

On Wednesday 20 August 2008, Rink Springer wrote:
> Hi Alfred,
>
> On Tue, Aug 19, 2008 at 12:44:13PM -0700, Alfred Perlstein wrote:
> > http://mu.org/~bright/usb2/usb4bsd.diff.gz
>
> Whenever I try this patch, my build dies with:
>
> cc -c -O2 -pipe -fno-strict-aliasing  -std=c99  -Wall -Wredundant-decls
> -Wnested-externs -Wstrict-prototypes  -Wmissing-prototypes
> -Wpointer-arith -Winline -Wcast-qual  -Wundef -Wno-pointer-sign
> -fformat-extensions -nostdinc  -I. -I../../.. -I../../../contrib/altq
> -D_KERNEL -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h -fno-common
> -finline-limit=8000 --param inline-unit-growth=100 --param
> large-function-growth=1000  -mno-align-long-strings
> -mpreferred-stack-boundary=2  -mno-mmx -mno-3dnow -mno-sse -mno-sse2
> -mno-sse3 -ffreestanding -fstack-protector -Werror
> ../../../dev/usb2/core/usb2_generic.c
> cc1: warnings being treated as errors
> ../../../dev/usb2/core/usb2_generic.c: In function 'ugen_ioctl':
> ../../../dev/usb2/core/usb2_generic.c:1409: warning: 'ep_index' may be
> used uninitialized in this function
> ../../../dev/usb2/core/usb2_generic.c:1409: note: 'ep_index' was
> declared here
> *** Error code 1
>
> I'm using a small patch to get it to compile:
>
> -	uint8_t ep_index;
> +	uint8_t ep_index = 0;
>
> However, I am unsure if this is correct.

Your patch is Ok. "ep_index" is not used uninitialized.

Try adding the patch in "ugen_fs_get_complete()" instead:

   1002 static uint8_t
   1003 ugen_fs_get_complete(struct usb2_fifo *f, uint8_t *pindex)
   1004 {
   1005         struct usb2_mbuf *m;
   1006 
   1007         USB_IF_DEQUEUE(&f->used_q, m);
   1008 
   1009         if (m) {
   1010                 *pindex = *((uint8_t *)(m->cur_data_ptr));
   1011 
   1012                 USB_IF_ENQUEUE(&f->free_q, m);
   1013 
   1014                 return (0);             /* success */
   1015         } else {
   1016                 f->flag_iscomplete = 0;
--here-- >>             *pindex = 0; /* fix compiler warning */
   1017         }
   1018         return (1);                     /* failure */
   1019 }

>
> Futhermore, 'device usb2_bluetooth' gives a lot of compile errors. Am I
> using the right patch here?

usb2_bluetooth depends on Netgraph which needs some extra options in the 
kernel config. You maybe want to build the module instead.

--HPS



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200808202216.21060.hselasky>