summaryrefslogtreecommitdiff
path: root/drivers/usb/class
diff options
context:
space:
mode:
authorMing Lei <ming.lei@canonical.com>2013-04-18 12:17:38 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-04-19 10:20:41 -0700
commitac9e59cad7b0b699b2aa9a104eb22ed67a560e02 (patch)
tree9de461b53f426632ef4be810f6eade869bd2b1ba /drivers/usb/class
parentc33c888b585fd9ed3770e91588480a0b74e82ad0 (diff)
downloadlinux-next-ac9e59cad7b0b699b2aa9a104eb22ed67a560e02.tar.gz
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>
Diffstat (limited to 'drivers/usb/class')
-rw-r--r--drivers/usb/class/usbtmc.c26
1 files changed, 4 insertions, 22 deletions
diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c
index 70d69d06054f..4c5506ae5e45 100644
--- a/drivers/usb/class/usbtmc.c
+++ b/drivers/usb/class/usbtmc.c
@@ -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)