aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2011-07-10 15:48:00 -0400
committerKevin O'Connor <kevin@koconnor.net>2011-07-10 15:48:00 -0400
commitffdcd3a8d72310efc55255fc93edf78c024bbafe (patch)
tree4833a4630f1b2bd359baddc7f217e81b09ed40b4
parent6f500511dc00bece01a192a9a8be168ced065ccd (diff)
downloadseabios-ffdcd3a8d72310efc55255fc93edf78c024bbafe.tar.gz
Minor fix - check for malloc failure in USB cntl allocation.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
-rw-r--r--src/usb-ehci.c4
-rw-r--r--src/usb-ohci.c4
-rw-r--r--src/usb-uhci.c4
3 files changed, 12 insertions, 0 deletions
diff --git a/src/usb-ehci.c b/src/usb-ehci.c
index 5028c0d..a60c607 100644
--- a/src/usb-ehci.c
+++ b/src/usb-ehci.c
@@ -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;
diff --git a/src/usb-ohci.c b/src/usb-ohci.c
index 317f200..9107db2 100644
--- a/src/usb-ohci.c
+++ b/src/usb-ohci.c
@@ -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;
diff --git a/src/usb-uhci.c b/src/usb-uhci.c
index 6e45474..f3680d3 100644
--- a/src/usb-uhci.c
+++ b/src/usb-uhci.c
@@ -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;