usbtmc: convert to devm_kzalloc
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Mon, 15 Jul 2013 08:59:41 +0000 (11:59 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Jul 2013 19:01:12 +0000 (12:01 -0700)
kfree(data) will be called implicitly.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/class/usbtmc.c

index d683f90a505b0831cbce3872ff67cc1c6b50cb47..60dd8918aeb923d29002ecedf17e58c26d16bd8f 100644 (file)
@@ -121,7 +121,6 @@ static void usbtmc_delete(struct kref *kref)
        struct usbtmc_device_data *data = to_usbtmc_data(kref);
 
        usb_put_dev(data->usb_dev);
-       kfree(data);
 }
 
 static int usbtmc_open(struct inode *inode, struct file *filp)
@@ -1101,7 +1100,7 @@ static int usbtmc_probe(struct usb_interface *intf,
 
        dev_dbg(&intf->dev, "%s called\n", __func__);
 
-       data = kmalloc(sizeof(struct usbtmc_device_data), GFP_KERNEL);
+       data = devm_kzalloc(&intf->dev, sizeof(*data), GFP_KERNEL);
        if (!data) {
                dev_err(&intf->dev, "Unable to allocate kernel memory\n");
                return -ENOMEM;