Skip to content

Commit

Permalink
usbtmc: convert to devm_kzalloc
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
andy-shev authored and gregkh committed Jul 25, 2013
1 parent bbf4976 commit e6c7efd
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/usb/class/usbtmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit e6c7efd

Please sign in to comment.