Catch various cases in libpayload where malloc() or memalign() return NULL

Signed-off-by: Stefan Reinauer <stepan@coresystems.de>
Acked-by: Peter Stuge <peter@stuge.se>


git-svn-id: svn://svn.coreboot.org/coreboot/trunk@4474 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
Stefan Reinauer
2009-07-31 11:39:55 +00:00
committed by Stefan Reinauer
parent 131c0070a3
commit 5fe6e23c61
10 changed files with 62 additions and 7 deletions

View File

@ -169,6 +169,8 @@ usb_hid_init (usbdev_t *dev)
boot_protos[interface->bInterfaceProtocol]);
if (interface->bInterfaceProtocol == hid_boot_proto_keyboard) {
dev->data = malloc (sizeof (usbhid_inst_t));
if (!dev->data)
usb_fatal("Not enough memory for USB HID device.\n");
printf (" configuring...\n");
usb_hid_set_protocol(dev, interface, hid_proto_boot);
usb_hid_set_idle(dev, interface, 0);