This patch performs additional checks in at91_udc, just in case of
some spurious interrupts or device enumeration.

Signed-off-by: Wojtek Kaniewski <[EMAIL PROTECTED]>
Cc: Andrew Victor <[EMAIL PROTECTED]>

--- linux-2.6.19.orig/drivers/usb/gadget/at91_udc.c     2006-12-08 
09:36:02.000000000 +0100
+++ linux-2.6.19/drivers/usb/gadget/at91_udc.c  2006-12-08 11:35:17.000000000 
+0100
@@ -936,7 +936,10 @@ static int at91_vbus_session(struct usb_
        // VDBG("vbus %s\n", is_active ? "on" : "off");
        local_irq_save(flags);
        udc->vbus = (is_active != 0);
-       pullup(udc, is_active);
+       if (udc->driver)
+               pullup(udc, is_active);
+       else
+               pullup(udc, 0);
        local_irq_restore(flags);
        return 0;
 }
@@ -1222,7 +1225,10 @@ static void handle_setup(struct at91_udc
 #undef w_length
 
        /* pass request up to the gadget driver */
-       status = udc->driver->setup(&udc->gadget, &pkt.r);
+       if (udc->driver)
+               status = udc->driver->setup(&udc->gadget, &pkt.r);
+       else
+               status = ENODEV;
        if (status < 0) {
 stall:
                VDBG("req %02x.%02x protocol STALL; stat %d\n",


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to