Skip to content

Commit

Permalink
HID: intel-ish-hid: use put_device() instead of kfree()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Arvind Yadav authored and Jiri Kosina committed Apr 26, 2018
1 parent 749ab30 commit a4eb490
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/hid/intel-ish-hid/ishtp/bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit a4eb490

Please sign in to comment.