Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

USB: at91_udc: Additional checks

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

Signed-off-by: Wojtek Kaniewski <wojtekka@toxygen.net>
Acked-by: David Brownell <dbrownell@users.sourceforge.net>
Cc: Andrew Victor <andrew@sanpeople.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

authored by

Wojtek Kaniewski and committed by
Greg Kroah-Hartman
bfb7fb79 943c4419

+8 -2
+8 -2
drivers/usb/gadget/at91_udc.c
··· 955 955 // VDBG("vbus %s\n", is_active ? "on" : "off"); 956 956 local_irq_save(flags); 957 957 udc->vbus = (is_active != 0); 958 - pullup(udc, is_active); 958 + if (udc->driver) 959 + pullup(udc, is_active); 960 + else 961 + pullup(udc, 0); 959 962 local_irq_restore(flags); 960 963 return 0; 961 964 } ··· 1244 1241 #undef w_length 1245 1242 1246 1243 /* pass request up to the gadget driver */ 1247 - status = udc->driver->setup(&udc->gadget, &pkt.r); 1244 + if (udc->driver) 1245 + status = udc->driver->setup(&udc->gadget, &pkt.r); 1246 + else 1247 + status = -ENODEV; 1248 1248 if (status < 0) { 1249 1249 stall: 1250 1250 VDBG("req %02x.%02x protocol STALL; stat %d\n",