summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/i2c/tda9950.c
diff options
context:
space:
mode:
authorColin Ian King <colin.king@canonical.com>2018-05-28 00:42:55 +0300
committerRussell King <rmk+kernel@armlinux.org.uk>2018-09-20 19:13:23 +0300
commitd98627d1360d55e3b28f702caca8b6342c4a4e45 (patch)
treee475cb32c694285a4c53be660d159df94bfe2c5e /drivers/gpu/drm/i2c/tda9950.c
parentf0316f93897c4c4e67278b175bfbfd3a95ba650a (diff)
downloadlinux-d98627d1360d55e3b28f702caca8b6342c4a4e45.tar.xz
drm/i2c: tda9950: fix timeout counter check
Currently the check to see if the timeout has reached zero is incorrect and the check is instead checking if the timeout is non-zero and not zero, hence it will break out of the loop on the first iteration and the msleep is never executed. Fix this by breaking from the loop when timeout is zero. Detected by CoverityScan, CID#1469404 ("Logically Dead Code") Fixes: f0316f93897c ("drm/i2c: tda9950: add CEC driver") Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Diffstat (limited to 'drivers/gpu/drm/i2c/tda9950.c')
-rw-r--r--drivers/gpu/drm/i2c/tda9950.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpu/drm/i2c/tda9950.c b/drivers/gpu/drm/i2c/tda9950.c
index 3f7396caad48..f2186409f0cf 100644
--- a/drivers/gpu/drm/i2c/tda9950.c
+++ b/drivers/gpu/drm/i2c/tda9950.c
@@ -307,7 +307,7 @@ static void tda9950_release(struct tda9950_priv *priv)
/* Wait up to .5s for it to signal non-busy */
do {
csr = tda9950_read(client, REG_CSR);
- if (!(csr & CSR_BUSY) || --timeout)
+ if (!(csr & CSR_BUSY) || !--timeout)
break;
msleep(10);
} while (1);