mei: fix return value on disconnect timeout
wait_event_timeout can return 0 or the remaining jiffies so return -ETIME if disconnected state not reached. Cc: stable@vger.kernel.org # 3.10+ 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>
This commit is contained in:
parent
d5d83f8abe
commit
fe2f17eb3d
@ -459,7 +459,7 @@ int mei_cl_disconnect(struct mei_cl *cl)
|
|||||||
{
|
{
|
||||||
struct mei_device *dev;
|
struct mei_device *dev;
|
||||||
struct mei_cl_cb *cb;
|
struct mei_cl_cb *cb;
|
||||||
int rets, err;
|
int rets;
|
||||||
|
|
||||||
if (WARN_ON(!cl || !cl->dev))
|
if (WARN_ON(!cl || !cl->dev))
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
@ -501,23 +501,18 @@ int mei_cl_disconnect(struct mei_cl *cl)
|
|||||||
}
|
}
|
||||||
mutex_unlock(&dev->device_lock);
|
mutex_unlock(&dev->device_lock);
|
||||||
|
|
||||||
err = wait_event_timeout(dev->wait_recvd_msg,
|
wait_event_timeout(dev->wait_recvd_msg,
|
||||||
MEI_FILE_DISCONNECTED == cl->state,
|
MEI_FILE_DISCONNECTED == cl->state,
|
||||||
mei_secs_to_jiffies(MEI_CL_CONNECT_TIMEOUT));
|
mei_secs_to_jiffies(MEI_CL_CONNECT_TIMEOUT));
|
||||||
|
|
||||||
mutex_lock(&dev->device_lock);
|
mutex_lock(&dev->device_lock);
|
||||||
|
|
||||||
if (MEI_FILE_DISCONNECTED == cl->state) {
|
if (MEI_FILE_DISCONNECTED == cl->state) {
|
||||||
rets = 0;
|
rets = 0;
|
||||||
cl_dbg(dev, cl, "successfully disconnected from FW client.\n");
|
cl_dbg(dev, cl, "successfully disconnected from FW client.\n");
|
||||||
} else {
|
} else {
|
||||||
rets = -ENODEV;
|
cl_dbg(dev, cl, "timeout on disconnect from FW client.\n");
|
||||||
if (MEI_FILE_DISCONNECTED != cl->state)
|
rets = -ETIME;
|
||||||
cl_err(dev, cl, "wrong status client disconnect.\n");
|
|
||||||
|
|
||||||
if (err)
|
|
||||||
cl_dbg(dev, cl, "wait failed disconnect err=%d\n", err);
|
|
||||||
|
|
||||||
cl_err(dev, cl, "failed to disconnect from FW client.\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mei_io_list_flush(&dev->ctrl_rd_list, cl);
|
mei_io_list_flush(&dev->ctrl_rd_list, cl);
|
||||||
|
Loading…
Reference in New Issue
Block a user