Browse Source

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 <arvind.yadav.cs@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Arvind Yadav 7 năm trước cách đây
mục cha
commit
a4eb490a41
1 tập tin đã thay đổi với 1 bổ sung1 xóa
  1. 1 1
      drivers/hid/intel-ish-hid/ishtp/bus.c

+ 1 - 1
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;
 	}