firmware: turris-mox-rwtm: fix reply status decoding function
[ Upstream commite34e60253d] 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 <kabel@kernel.org> Reviewed-by: Pali Rohár <pali@kernel.org> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Fixes:389711b374("firmware: Add Turris Mox rWTM firmware driver") Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
804aabb509
commit
271c12dbeb
@@ -147,11 +147,14 @@ MOX_ATTR_RO(pubkey, "%s\n", pubkey);
|
|||||||
|
|
||||||
static int mox_get_status(enum mbox_cmd cmd, u32 retval)
|
static int mox_get_status(enum mbox_cmd cmd, u32 retval)
|
||||||
{
|
{
|
||||||
if (MBOX_STS_CMD(retval) != cmd ||
|
if (MBOX_STS_CMD(retval) != cmd)
|
||||||
MBOX_STS_ERROR(retval) != MBOX_STS_SUCCESS)
|
|
||||||
return -EIO;
|
return -EIO;
|
||||||
else if (MBOX_STS_ERROR(retval) == MBOX_STS_FAIL)
|
else if (MBOX_STS_ERROR(retval) == MBOX_STS_FAIL)
|
||||||
return -(int)MBOX_STS_VALUE(retval);
|
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
|
else
|
||||||
return MBOX_STS_VALUE(retval);
|
return MBOX_STS_VALUE(retval);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user