diff options
author | Nico Huber <nico.huber@secunet.com> | 2012-05-25 09:59:19 +0200 |
---|---|---|
committer | Stefan Reinauer <stefan.reinauer@coreboot.org> | 2012-06-07 23:15:28 +0200 |
commit | 4842dfe6f77c21f7074ca79b0ce3f882f08f92b2 (patch) | |
tree | 19908afc1f5ef3ede965d862d878620d82147f12 /payloads/libpayload/drivers | |
parent | 1ab6075320f5dc10afd934b100c8116a88ac12fc (diff) | |
download | coreboot-4842dfe6f77c21f7074ca79b0ce3f882f08f92b2.tar.xz |
libpayload: Free intr queue structure in usb_hid_destroy
The call to destroy_intr_queue was missing in usb_hid_destroy.
Change-Id: I51ccc6a79bc005819317263be24a56c51acd5f55
Signed-off-by: Nico Huber <nico.huber@secunet.com>
Reviewed-on: http://review.coreboot.org/1082
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'payloads/libpayload/drivers')
-rw-r--r-- | payloads/libpayload/drivers/usb/usbhid.c | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/payloads/libpayload/drivers/usb/usbhid.c b/payloads/libpayload/drivers/usb/usbhid.c index 840b298cf8..d5141c6353 100644 --- a/payloads/libpayload/drivers/usb/usbhid.c +++ b/payloads/libpayload/drivers/usb/usbhid.c @@ -42,12 +42,6 @@ enum { GET_REPORT = 0x1, GET_IDLE = 0x2, GET_PROTOCOL = 0x3, SET_REPORT = 0x9, SET_IDLE = 0xa, SET_PROTOCOL = 0xb }; -static void -usb_hid_destroy (usbdev_t *dev) -{ - free (dev->data); -} - typedef struct { void* queue; hid_descriptor_t *descriptor; @@ -55,6 +49,27 @@ typedef struct { #define HID_INST(dev) ((usbhid_inst_t*)(dev)->data) +static void +usb_hid_destroy (usbdev_t *dev) +{ + if (HID_INST(dev)->queue) { + int i; + for (i = 0; i <= dev->num_endp; i++) { + if (dev->endpoints[i].endpoint == 0) + continue; + if (dev->endpoints[i].type != INTERRUPT) + continue; + if (dev->endpoints[i].direction != IN) + continue; + break; + } + dev->controller->destroy_intr_queue( + &dev->endpoints[i], HID_INST(dev)->queue); + HID_INST(dev)->queue = NULL; + } + free (dev->data); +} + /* keybuffer is global to all USB keyboards */ static int keycount; #define KEYBOARD_BUFFER_SIZE 16 |