mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -04:00
firmware: turris-mox-rwtm: fix reply status decoding function
[ Upstream commit e34e60253d9272311831daed8a2d967cf80ca3dc ]
The status decoding function mox_get_status() currently contains an
incorrect check: if the error status is not MBOX_STS_SUCCESS, it always
returns -EIO, so the comparison to MBOX_STS_FAIL is never executed and
we don't get the actual error code sent by the firmware.
Fix this.
Signed-off-by: Marek Behún <[email protected]>
Reviewed-by: Pali Rohár <[email protected]>
Reviewed-by: Andrew Lunn <[email protected]>
Fixes: 389711b374 ("firmware: Add Turris Mox rWTM firmware driver")
Signed-off-by: Gregory CLEMENT <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
This commit is contained in:
parent
65f32d1e05
commit
7934e06073
1 changed files with 5 additions and 2 deletions
|
|
@ -134,11 +134,14 @@ MOX_ATTR_RO(pubkey, "%s\n", pubkey);
|
|||
|
||||
static int mox_get_status(enum mbox_cmd cmd, u32 retval)
|
||||
{
|
||||
if (MBOX_STS_CMD(retval) != cmd ||
|
||||
MBOX_STS_ERROR(retval) != MBOX_STS_SUCCESS)
|
||||
if (MBOX_STS_CMD(retval) != cmd)
|
||||
return -EIO;
|
||||
else if (MBOX_STS_ERROR(retval) == MBOX_STS_FAIL)
|
||||
return -(int)MBOX_STS_VALUE(retval);
|
||||
else if (MBOX_STS_ERROR(retval) == MBOX_STS_BADCMD)
|
||||
return -ENOSYS;
|
||||
else if (MBOX_STS_ERROR(retval) != MBOX_STS_SUCCESS)
|
||||
return -EIO;
|
||||
else
|
||||
return MBOX_STS_VALUE(retval);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue