[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[MiNT] [PATCH][1/3] USB: if device allocation not possible return error



Commit message:

If allocation of a new USB device is not possible, probably because we
have reached the maximum number of allocated devices allowed, return error.

Contributed by David Galvez.
diff -r 816c5e706c3f -r 6c160c702aea sys/usb/src.km/hub.c
--- a/sys/usb/src.km/hub.c	Fri Mar 27 12:30:16 2015 +0100
+++ b/sys/usb/src.km/hub.c	Sat Apr 04 13:38:38 2015 +0200
@@ -314,6 +314,10 @@
 
 	/* Allocate a new device struct for it */
 	usb = usb_alloc_new_device(dev->controller);
+	if (!usb) 
+	{
+		return -1;
+	}
 
 	switch (portstatus & USB_PORT_STAT_SPEED_MASK) {
 	case USB_PORT_STAT_SUPER_SPEED: