mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-13 14:24:11 +08:00
firmware: turris-mox-rwtm: Fix checking return value of wait_for_completion_timeout()
[ Upstream commit8467cfe821
] The wait_for_completion_timeout() function returns 0 if timed out, and a positive value if completed. Fix the usage of this function. Fixes:389711b374
("firmware: Add Turris Mox rWTM firmware driver") Fixes:2eab59cf0d
("firmware: turris-mox-rwtm: fail probing when firmware does not support hwrng") Signed-off-by: Marek Behún <kabel@kernel.org> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Reviewed-by: Andy Shevchenko <andy@kernel.org> Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
6f3cb1fd6b
commit
085dc94289
@ -199,9 +199,8 @@ static int mox_get_board_info(struct mox_rwtm *rwtm)
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ret = wait_for_completion_timeout(&rwtm->cmd_done, HZ / 2);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
if (!wait_for_completion_timeout(&rwtm->cmd_done, HZ / 2))
|
||||
return -ETIMEDOUT;
|
||||
|
||||
ret = mox_get_status(MBOX_CMD_BOARD_INFO, reply->retval);
|
||||
if (ret == -ENODATA) {
|
||||
@ -235,9 +234,8 @@ static int mox_get_board_info(struct mox_rwtm *rwtm)
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ret = wait_for_completion_timeout(&rwtm->cmd_done, HZ / 2);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
if (!wait_for_completion_timeout(&rwtm->cmd_done, HZ / 2))
|
||||
return -ETIMEDOUT;
|
||||
|
||||
ret = mox_get_status(MBOX_CMD_ECDSA_PUB_KEY, reply->retval);
|
||||
if (ret == -ENODATA) {
|
||||
@ -274,9 +272,8 @@ static int check_get_random_support(struct mox_rwtm *rwtm)
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ret = wait_for_completion_timeout(&rwtm->cmd_done, HZ / 2);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
if (!wait_for_completion_timeout(&rwtm->cmd_done, HZ / 2))
|
||||
return -ETIMEDOUT;
|
||||
|
||||
return mox_get_status(MBOX_CMD_GET_RANDOM, rwtm->reply.retval);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user