mei: expedite ioctl return on the notify set operation error
authorAlexander Usyskin <alexander.usyskin@intel.com>
Tue, 6 Nov 2018 10:04:40 +0000 (12:04 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 7 Nov 2018 12:53:03 +0000 (13:53 +0100)
The notify set operation ioctl will wait till timeout is expired
even in case when the FW returned an error.
Check the status field of the client object in wait_event_timeout()
to determine if the caller can return earlier.

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/misc/mei/client.c

index ee58561ceb08b6995e9e72dd98ce2d5f5a4868af..1fe9426ce48becfcf29d12fd39a850e9ab004463 100644 (file)
@@ -1357,7 +1357,9 @@ int mei_cl_notify_request(struct mei_cl *cl,
 
        mutex_unlock(&dev->device_lock);
        wait_event_timeout(cl->wait,
-                          cl->notify_en == request || !mei_cl_is_connected(cl),
+                          cl->notify_en == request ||
+                          cl->status ||
+                          !mei_cl_is_connected(cl),
                           mei_secs_to_jiffies(MEI_CL_CONNECT_TIMEOUT));
        mutex_lock(&dev->device_lock);