diff options
Diffstat (limited to 'linux/drivers/media/dvb')
-rw-r--r-- | linux/drivers/media/dvb/ttusb-dec/ttusb_dec.c | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/linux/drivers/media/dvb/ttusb-dec/ttusb_dec.c b/linux/drivers/media/dvb/ttusb-dec/ttusb_dec.c index 95e1e62c9..2a05108e2 100644 --- a/linux/drivers/media/dvb/ttusb-dec/ttusb_dec.c +++ b/linux/drivers/media/dvb/ttusb-dec/ttusb_dec.c @@ -1,7 +1,7 @@ /* * TTUSB DEC Driver * - * Copyright (C) 2003 Alex Woods <linux-dvb@giblets.org> + * Copyright (C) 2003-2004 Alex Woods <linux-dvb@giblets.org> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -210,12 +210,23 @@ static int ttusb_dec_send_command(struct ttusb_dec *dec, const u8 command, int *result_length, u8 cmd_result[]) { int result, actual_len, i; - u8 b[COMMAND_PACKET_SIZE + 4]; - u8 c[COMMAND_PACKET_SIZE + 4]; + u8 *b; + u8 *c; dprintk("%s\n", __FUNCTION__); + b = kmalloc(COMMAND_PACKET_SIZE + 4, GFP_KERNEL); + if (!b) + return -ENOMEM; + c = kmalloc(COMMAND_PACKET_SIZE + 4, GFP_KERNEL); + if (!c) { + kfree(b); + return -ENOMEM; + } + if ((result = down_interruptible(&dec->usb_sem))) { + kfree(b); + kfree(c); printk("%s: Failed to down usb semaphore.\n", __FUNCTION__); return result; } @@ -236,22 +247,26 @@ static int ttusb_dec_send_command(struct ttusb_dec *dec, const u8 command, } result = usb_bulk_msg(dec->udev, dec->command_pipe, b, - sizeof(b), &actual_len, HZ); + COMMAND_PACKET_SIZE + 4, &actual_len, HZ); if (result) { printk("%s: command bulk message failed: error %d\n", __FUNCTION__, result); up(&dec->usb_sem); + kfree(b); + kfree(c); return result; } result = usb_bulk_msg(dec->udev, dec->result_pipe, c, - sizeof(c), &actual_len, HZ); + COMMAND_PACKET_SIZE + 4, &actual_len, HZ); if (result) { printk("%s: result bulk message failed: error %d\n", __FUNCTION__, result); up(&dec->usb_sem); + kfree(b); + kfree(c); return result; } else { if (debug) { @@ -268,6 +283,8 @@ static int ttusb_dec_send_command(struct ttusb_dec *dec, const u8 command, up(&dec->usb_sem); + kfree(b); + kfree(c); return 0; } } |