提交 d3fd5bfd 编写于 作者: A Anirudh Rayabharam 提交者: Zheng Zengkai

firmware_loader: use -ETIMEDOUT instead of -EAGAIN in fw_load_sysfs_fallback

stable inclusion
from stable-5.10.58
commit 5019f5812bbf375c95a3b7f4f62e1b3580431c26
bugzilla: 176984 https://gitee.com/openeuler/kernel/issues/I4E2P4

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=5019f5812bbf375c95a3b7f4f62e1b3580431c26

--------------------------------

commit 0d6434e1 upstream.

The only motivation for using -EAGAIN in commit 0542ad88
("firmware loader: Fix _request_firmware_load() return val for fw load
abort") was to distinguish the error from -ENOMEM, and so there is no
real reason in keeping it. -EAGAIN is typically used to tell the
userspace to try something again and in this case re-using the sysfs
loading interface cannot be retried when a timeout happens, so the
return value is also bogus.

-ETIMEDOUT is received when the wait times out and returning that
is much more telling of what the reason for the failure was. So, just
propagate that instead of returning -EAGAIN.
Suggested-by: NLuis Chamberlain <mcgrof@kernel.org>
Reviewed-by: NShuah Khan <skhan@linuxfoundation.org>
Acked-by: NLuis Chamberlain <mcgrof@kernel.org>
Signed-off-by: NAnirudh Rayabharam <mail@anirudhrb.com>
Cc: stable <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210728085107.4141-2-mail@anirudhrb.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Acked-by: NWeilong Chen <chenweilong@huawei.com>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 b64501e5
...@@ -535,8 +535,6 @@ static int fw_load_sysfs_fallback(struct fw_sysfs *fw_sysfs, long timeout) ...@@ -535,8 +535,6 @@ static int fw_load_sysfs_fallback(struct fw_sysfs *fw_sysfs, long timeout)
if (fw_state_is_aborted(fw_priv)) { if (fw_state_is_aborted(fw_priv)) {
if (retval == -ERESTARTSYS) if (retval == -ERESTARTSYS)
retval = -EINTR; retval = -EINTR;
else
retval = -EAGAIN;
} else if (fw_priv->is_paged_buf && !fw_priv->data) } else if (fw_priv->is_paged_buf && !fw_priv->data)
retval = -ENOMEM; retval = -ENOMEM;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册