HID: intel-ish-hid: use put_device() instead of kfree()
authorArvind Yadav <arvind.yadav.cs@gmail.com>
Fri, 30 Mar 2018 11:26:10 +0000 (16:56 +0530)
committerJiri Kosina <jkosina@suse.cz>
Thu, 26 Apr 2018 12:36:43 +0000 (14:36 +0200)
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 <arvind.yadav.cs@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/intel-ish-hid/ishtp/bus.c

index f272cdd9bd558311c27a82729c5eb314cade2a1f..2623a567ffba5ae51e90653e47bea42127ea9b02 100644 (file)
@@ -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;
        }