[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180102175424.14391-3-srinivas.kandagatla@linaro.org>
Date: Tue, 2 Jan 2018 17:54:20 +0000
From: srinivas.kandagatla@...aro.org
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: sdharia@...eaurora.org, linux-arm-msm@...r.kernel.org,
alsa-devel@...a-project.org, linux-kernel@...r.kernel.org,
Colin Ian King <colin.king@...onical.com>,
Srinivas Kandagatla <srinivas.kandagatla@...aro.org>
Subject: [PATCH 2/6] slimbus: fix retries comparison to correctly identify failed allocation
From: Colin Ian King <colin.king@...onical.com>
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: Colin Ian King <colin.king@...onical.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@...aro.org>
---
drivers/slimbus/qcom-ctrl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/slimbus/qcom-ctrl.c b/drivers/slimbus/qcom-ctrl.c
index fb1a5e0eb8dd..2d67419a3c37 100644
--- a/drivers/slimbus/qcom-ctrl.c
+++ b/drivers/slimbus/qcom-ctrl.c
@@ -345,7 +345,7 @@ static int qcom_xfer_msg(struct slim_controller *sctrl,
}
}
- if (!retries && !pbuf)
+ if (retries < 0 && !pbuf)
return -ENOMEM;
puc = (u8 *)pbuf;
--
2.15.0
Powered by blists - more mailing lists