In the course of the read flow we want to wait for read completion only
if the read queue is empty.
However the calling list_empty(&cl->rd_completed) is a duplication as the
same check was performed by mei_cl_read_cb() and the waiting is skipped
if it returns not NULL.
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>
                goto out;
 
        /* wait on event only if there is no other waiter */
-       if (list_empty(&cl->rd_completed) && !waitqueue_active(&cl->rx_wait)) {
+       /* synchronized under device mutex */
+       if (!waitqueue_active(&cl->rx_wait)) {
 
                mutex_unlock(&bus->device_lock);
 
 
                goto out;
        }
 
-       if (list_empty(&cl->rd_completed) && !waitqueue_active(&cl->rx_wait)) {
+       /* synchronized under device mutex */
+       if (!waitqueue_active(&cl->rx_wait)) {
                if (file->f_flags & O_NONBLOCK) {
                        rets = -EAGAIN;
                        goto out;