]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
HID: do not use down_interruptible() when unbinding devices
authorDmitry Torokhov <dmitry.torokhov@gmail.com>
Sat, 20 Mar 2021 00:27:16 +0000 (17:27 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 20 Jul 2021 14:15:45 +0000 (16:15 +0200)
[ Upstream commit f2145f8dc566c4f3b5a8deb58dcd12bed4e20194 ]

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>
drivers/hid/hid-core.c

index acbbc21e623388acf0ce75c4d3a5dcdfde2d363e..4549fbb741563434871c0e1209a4f9fb170640ca 100644 (file)
@@ -2124,12 +2124,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;
@@ -2144,8 +2140,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,