Minor fix - check for malloc failure in USB cntl allocation.
authorKevin O'Connor <kevin@koconnor.net>
Sun, 10 Jul 2011 19:48:00 +0000 (15:48 -0400)
committerKevin O'Connor <kevin@koconnor.net>
Sun, 10 Jul 2011 19:48:00 +0000 (15:48 -0400)
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
src/usb-ehci.c
src/usb-ohci.c
src/usb-uhci.c

index 5028c0d6688c3b1c7caa2383d3157313891aac1a..a60c60715cad93693170fb1bf9798ca7e460bacd 100644 (file)
@@ -263,6 +263,10 @@ ehci_init(struct pci_device *pci, int busid, struct pci_device *comppci)
     }
 
     struct usb_ehci_s *cntl = malloc_tmphigh(sizeof(*cntl));
+    if (!cntl) {
+        warn_noalloc();
+        return -1;
+    }
     memset(cntl, 0, sizeof(*cntl));
     cntl->usb.busid = busid;
     cntl->usb.pci = pci;
index 317f200c65f0348ae1c2082d28a5265716e2e266..9107db2bcd2af68e76fc7ceb9656d7dd4d1c73c6 100644 (file)
@@ -209,6 +209,10 @@ ohci_init(struct pci_device *pci, int busid)
     if (! CONFIG_USB_OHCI)
         return;
     struct usb_ohci_s *cntl = malloc_tmphigh(sizeof(*cntl));
+    if (!cntl) {
+        warn_noalloc();
+        return;
+    }
     memset(cntl, 0, sizeof(*cntl));
     cntl->usb.busid = busid;
     cntl->usb.pci = pci;
index 6e454742e5d81fdb02deb84184441f87cb737d09..f3680d34d11c30d06c2dea76fb32f76b38455b7c 100644 (file)
@@ -185,6 +185,10 @@ uhci_init(struct pci_device *pci, int busid)
         return;
     u16 bdf = pci->bdf;
     struct usb_uhci_s *cntl = malloc_tmphigh(sizeof(*cntl));
+    if (!cntl) {
+        warn_noalloc();
+        return;
+    }
     memset(cntl, 0, sizeof(*cntl));
     cntl->usb.busid = busid;
     cntl->usb.pci = pci;