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>
This commit is contained in:
Nico Huber 2012-05-25 09:59:19 +02:00 committed by Stefan Reinauer
parent 1ab6075320
commit 4842dfe6f7
1 changed files with 21 additions and 6 deletions

View File

@ -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