From: Arvind Yadav Date: Fri, 30 Mar 2018 11:26:10 +0000 (+0530) Subject: HID: intel-ish-hid: use put_device() instead of kfree() X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=a4eb490a41a0da3b1275fc7427084cf9ae2c3c1c;p=openwrt%2Fstaging%2Fblogic.git HID: intel-ish-hid: use put_device() instead of kfree() Never directly free @dev after calling device_register(), even if it returned an error. Always use put_device() to give up the reference initialized. Signed-off-by: Arvind Yadav Signed-off-by: Jiri Kosina --- diff --git a/drivers/hid/intel-ish-hid/ishtp/bus.c b/drivers/hid/intel-ish-hid/ishtp/bus.c index f272cdd9bd55..2623a567ffba 100644 --- a/drivers/hid/intel-ish-hid/ishtp/bus.c +++ b/drivers/hid/intel-ish-hid/ishtp/bus.c @@ -418,7 +418,7 @@ static struct ishtp_cl_device *ishtp_bus_add_device(struct ishtp_device *dev, list_del(&device->device_link); spin_unlock_irqrestore(&dev->device_list_lock, flags); dev_err(dev->devc, "Failed to register ISHTP client device\n"); - kfree(device); + put_device(&device->dev); return NULL; }