提交 551b9ee4 编写于 作者: C Colin Ian King 提交者: Greg Kroah-Hartman

slimbus: fix retries comparison to correctly identify failed allocation

Currently the check for too many retries fails because retries is actually
-1 when the retry loop terminates if no pbuf can be allocated because of
the post decrement on retries.  Fix this by not comparing retries with zero
but instead check if it is negative.

Detected by CoverityScan, CID#1463143 ("Logically dead code") and
CID#1463144 ("Dereference after null check")
Signed-off-by: NColin Ian King <colin.king@canonical.com>
Signed-off-by: NSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 7dde60c0
...@@ -345,7 +345,7 @@ static int qcom_xfer_msg(struct slim_controller *sctrl, ...@@ -345,7 +345,7 @@ static int qcom_xfer_msg(struct slim_controller *sctrl,
} }
} }
if (!retries && !pbuf) if (retries < 0 && !pbuf)
return -ENOMEM; return -ENOMEM;
puc = (u8 *)pbuf; puc = (u8 *)pbuf;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册