Skip to content

Commit

Permalink
HID: do not use down_interruptible() when unbinding devices
Browse files Browse the repository at this point in the history
[ Upstream commit f2145f8 ]

Action of unbinding driver from a device is not cancellable and should not
fail, and driver core does not pay attention to the result of "remove"
method, therefore using down_interruptible() in hid_device_remove() does
not make sense.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
dtor authored and gregkh committed Jul 14, 2021
1 parent c92ff38 commit 1f96eae
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions drivers/hid/hid-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -2306,12 +2306,8 @@ static int hid_device_remove(struct device *dev)
{
struct hid_device *hdev = to_hid_device(dev);
struct hid_driver *hdrv;
int ret = 0;

if (down_interruptible(&hdev->driver_input_lock)) {
ret = -EINTR;
goto end;
}
down(&hdev->driver_input_lock);
hdev->io_started = false;

hdrv = hdev->driver;
Expand All @@ -2326,8 +2322,8 @@ static int hid_device_remove(struct device *dev)

if (!hdev->io_started)
up(&hdev->driver_input_lock);
end:
return ret;

return 0;
}

static ssize_t modalias_show(struct device *dev, struct device_attribute *a,
Expand Down

0 comments on commit 1f96eae

Please sign in to comment.