USB: usbtmc: remove unnecessary memory allocation

Inside usbtmc_ioctl_clear_out_halt()/usbtmc_ioctl_clear_in_halt(),
usb_clear_halt() needn't any buffer to pass in, so remove the
unnecessary memory allocation.

Signed-off-by: Ming Lei <ming.lei@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Ming Lei 2013-04-18 12:17:38 +08:00 коммит произвёл Greg Kroah-Hartman
Родитель c33c888b58
Коммит ac9e59cad7
1 изменённых файлов: 4 добавлений и 22 удалений

Просмотреть файл

@ -718,50 +718,32 @@ exit:
static int usbtmc_ioctl_clear_out_halt(struct usbtmc_device_data *data)
{
u8 *buffer;
int rv;
buffer = kmalloc(2, GFP_KERNEL);
if (!buffer)
return -ENOMEM;
rv = usb_clear_halt(data->usb_dev,
usb_sndbulkpipe(data->usb_dev, data->bulk_out));
if (rv < 0) {
dev_err(&data->usb_dev->dev, "usb_control_msg returned %d\n",
rv);
goto exit;
return rv;
}
rv = 0;
exit:
kfree(buffer);
return rv;
return 0;
}
static int usbtmc_ioctl_clear_in_halt(struct usbtmc_device_data *data)
{
u8 *buffer;
int rv;
buffer = kmalloc(2, GFP_KERNEL);
if (!buffer)
return -ENOMEM;
rv = usb_clear_halt(data->usb_dev,
usb_rcvbulkpipe(data->usb_dev, data->bulk_in));
if (rv < 0) {
dev_err(&data->usb_dev->dev, "usb_control_msg returned %d\n",
rv);
goto exit;
return rv;
}
rv = 0;
exit:
kfree(buffer);
return rv;
return 0;
}
static int get_capabilities(struct usbtmc_device_data *data)