diff options
| author | Alexander Usyskin <alexander.usyskin@intel.com> | 2014-07-17 03:53:38 -0400 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-07-17 21:38:37 -0400 |
| commit | fe2f17eb3da38ac0d5a00c511255bf3a33d16d24 (patch) | |
| tree | bcc4660cd2e1cadb29fd68415be5fe33ac4a4666 | |
| parent | d5d83f8abea13d0b50ee762276c6c900d1946264 (diff) | |
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>
| -rw-r--r-- | drivers/misc/mei/client.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/drivers/misc/mei/client.c b/drivers/misc/mei/client.c index 65545007745e..324e1de93687 100644 --- a/drivers/misc/mei/client.c +++ b/drivers/misc/mei/client.c | |||
| @@ -459,7 +459,7 @@ int mei_cl_disconnect(struct mei_cl *cl) | |||
| 459 | { | 459 | { |
| 460 | struct mei_device *dev; | 460 | struct mei_device *dev; |
| 461 | struct mei_cl_cb *cb; | 461 | struct mei_cl_cb *cb; |
| 462 | int rets, err; | 462 | int rets; |
| 463 | 463 | ||
| 464 | if (WARN_ON(!cl || !cl->dev)) | 464 | if (WARN_ON(!cl || !cl->dev)) |
| 465 | return -ENODEV; | 465 | return -ENODEV; |
| @@ -501,23 +501,18 @@ int mei_cl_disconnect(struct mei_cl *cl) | |||
| 501 | } | 501 | } |
| 502 | mutex_unlock(&dev->device_lock); | 502 | mutex_unlock(&dev->device_lock); |
| 503 | 503 | ||
| 504 | err = wait_event_timeout(dev->wait_recvd_msg, | 504 | wait_event_timeout(dev->wait_recvd_msg, |
| 505 | MEI_FILE_DISCONNECTED == cl->state, | 505 | MEI_FILE_DISCONNECTED == cl->state, |
| 506 | mei_secs_to_jiffies(MEI_CL_CONNECT_TIMEOUT)); | 506 | mei_secs_to_jiffies(MEI_CL_CONNECT_TIMEOUT)); |
| 507 | 507 | ||
| 508 | mutex_lock(&dev->device_lock); | 508 | mutex_lock(&dev->device_lock); |
| 509 | |||
| 509 | if (MEI_FILE_DISCONNECTED == cl->state) { | 510 | if (MEI_FILE_DISCONNECTED == cl->state) { |
| 510 | rets = 0; | 511 | rets = 0; |
| 511 | cl_dbg(dev, cl, "successfully disconnected from FW client.\n"); | 512 | cl_dbg(dev, cl, "successfully disconnected from FW client.\n"); |
| 512 | } else { | 513 | } else { |
| 513 | rets = -ENODEV; | 514 | cl_dbg(dev, cl, "timeout on disconnect from FW client.\n"); |
| 514 | if (MEI_FILE_DISCONNECTED != cl->state) | 515 | rets = -ETIME; |
| 515 | cl_err(dev, cl, "wrong status client disconnect.\n"); | ||
| 516 | |||
| 517 | if (err) | ||
| 518 | cl_dbg(dev, cl, "wait failed disconnect err=%d\n", err); | ||
| 519 | |||
| 520 | cl_err(dev, cl, "failed to disconnect from FW client.\n"); | ||
| 521 | } | 516 | } |
| 522 | 517 | ||
| 523 | mei_io_list_flush(&dev->ctrl_rd_list, cl); | 518 | mei_io_list_flush(&dev->ctrl_rd_list, cl); |
