瀏覽代碼

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>
Colin Ian King 7 年之前
父節點
當前提交
d98627d136
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      drivers/gpu/drm/i2c/tda9950.c

+ 1 - 1
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 */
 	/* Wait up to .5s for it to signal non-busy */
 	do {
 	do {
 		csr = tda9950_read(client, REG_CSR);
 		csr = tda9950_read(client, REG_CSR);
-		if (!(csr & CSR_BUSY) || --timeout)
+		if (!(csr & CSR_BUSY) || !--timeout)
 			break;
 			break;
 		msleep(10);
 		msleep(10);
 	} while (1);
 	} while (1);