On Fri, Nov 19, 2010 at 03:29:57PM -0800, Matthew Dempsky wrote:
> On Fri, Nov 19, 2010 at 06:21:24PM -0500, Brad wrote:
> > The diff needs to be updated for an up to date -current tree.
> 
> Sigh, nothing's working out for me today... I guess karma for slacking
> lately. :)
> 
> Index: uhci.c
> ===================================================================
> RCS file: /cvs/src/sys/dev/usb/uhci.c,v
> retrieving revision 1.85
> diff -u -p -r1.85 uhci.c
> --- uhci.c    19 Nov 2010 18:42:27 -0000      1.85
> +++ uhci.c    19 Nov 2010 23:24:17 -0000
> @@ -2740,7 +2740,7 @@ uhci_remove_intr(uhci_softc_t *sc, uhci_
>  usbd_status
>  uhci_device_setintr(uhci_softc_t *sc, struct uhci_pipe *upipe, int ival)
>  {
> -     uhci_soft_qh_t *sqh;
> +     uhci_soft_qh_t *sqh, **qhs;
>       int i, npoll, s;
>       u_int bestbw, bw, bestoffs, offs;
>  
> @@ -2755,10 +2755,8 @@ uhci_device_setintr(uhci_softc_t *sc, st
>       npoll = (UHCI_VFRAMELIST_COUNT + ival - 1) / ival;
>       DPRINTFN(2, ("uhci_device_setintr: ival=%d npoll=%d\n", ival, npoll));
>  
> -     upipe->u.intr.npoll = npoll;
> -     upipe->u.intr.qhs =
> -         malloc(npoll * sizeof(uhci_soft_qh_t *), M_USBHC, M_NOWAIT);
> -     if (upipe->u.intr.qhs == NULL)
> +     qhs = malloc(npoll * sizeof(uhci_soft_qh_t *), M_USBHC, M_NOWAIT);
> +     if (qhs == NULL)
>               return (USBD_NOMEM);
>  
>       /*
> @@ -2777,12 +2775,22 @@ uhci_device_setintr(uhci_softc_t *sc, st
>       DPRINTFN(1, ("uhci_device_setintr: bw=%d offs=%d\n", bestbw, bestoffs));
>  
>       for(i = 0; i < npoll; i++) {
> -             upipe->u.intr.qhs[i] = sqh = uhci_alloc_sqh(sc);
> +             sqh = uhci_alloc_sqh(sc);
> +             if (sqh == NULL) {
> +                     while (i > 0)
> +                             uhci_free_sqh(sc, qhs[--i]);
> +                     free(qhs, M_USBHC);
> +                     return (USBD_NOMEM);
> +             }
>               sqh->elink = NULL;
>               sqh->qh.qh_elink = htole32(UHCI_PTR_T);
>               sqh->pos = MOD(i * ival + bestoffs);
> +             qhs[i] = sqh;
>       }
>  #undef MOD
> +
> +     upipe->u.intr.npoll = npoll;
> +     upipe->u.intr.qhs = qhs;
>  
>       s = splusb();
>       /* Enter QHs into the controller data structures. */

ok

-- 
jake...@sdf.lonestar.org
SDF Public Access UNIX System - http://sdf.lonestar.org

Reply via email to