[PATCH driver-core/master] firmware: Correct handling of fw_state_wait_timeout() return value

From: Jakub Kicinski
Date: Mon Jan 16 2017 - 09:57:32 EST


Commit 5d47ec02c37e ("firmware: Correct handling of fw_state_wait()
return value") made the assumption that any error returned from
fw_state_wait_timeout() means FW load has to be aborted. This is
incorrect FW load only has to be aborted when load timed out or
has been interrupted, otherwise the waking thread had already
cleaned up for us.

Fixes: 5d47ec02c37e ("firmware: Correct handling of fw_state_wait() return value")
Signed-off-by: Jakub Kicinski <jakub.kicinski@xxxxxxxxxxxxx>
---
drivers/base/firmware_class.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
index 4497d263209f..ce142e6b2c72 100644
--- a/drivers/base/firmware_class.c
+++ b/drivers/base/firmware_class.c
@@ -1020,7 +1020,7 @@ static int _request_firmware_load(struct firmware_priv *fw_priv,
}

retval = fw_state_wait_timeout(&buf->fw_st, timeout);
- if (retval < 0) {
+ if (retval == -ETIMEDOUT || retval == -ERESTARTSYS) {
mutex_lock(&fw_lock);
fw_load_abort(fw_priv);
mutex_unlock(&fw_lock);
--
2.11.0