]> err.no Git - linux-2.6/blobdiff - drivers/usb/gadget/at91_udc.c
USB: at91_udc: Additional checks
[linux-2.6] / drivers / usb / gadget / at91_udc.c
index 1926d39e480144997486e6efbcaf71f7767948b1..812c733ba8ce52f40da03b3c690a9375208c1981 100644 (file)
@@ -955,7 +955,10 @@ static int at91_vbus_session(struct usb_gadget *gadget, int is_active)
        // 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;
 }
@@ -1241,7 +1244,10 @@ static void handle_setup(struct at91_udc *udc, struct at91_ep *ep, u32 csr)
 #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",