提交 e5b95c8f 编写于 作者: C Colin Ian King 提交者: Mauro Carvalho Chehab

media: i2c: fix error check on max9286_read call

Currently the error return from the call to max9286_read is masked
with 0xf0 so the following check for a negative error return is
never true.  Fix this by checking for an error first, then masking
the return value for subsequent conflink_mask checking.

Addresses-Coverity: ("Logically dead code")

Fixes: 66d8c9d2 ("media: i2c: Add MAX9286 driver")
Signed-off-by: NColin Ian King <colin.king@canonical.com>
Reviewed-by: NKieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: NSakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: NMauro Carvalho Chehab <mchehab+huawei@kernel.org>
上级 4eb5928d
...@@ -405,10 +405,11 @@ static int max9286_check_config_link(struct max9286_priv *priv, ...@@ -405,10 +405,11 @@ static int max9286_check_config_link(struct max9286_priv *priv,
* to 5 milliseconds. * to 5 milliseconds.
*/ */
for (i = 0; i < 10; i++) { for (i = 0; i < 10; i++) {
ret = max9286_read(priv, 0x49) & 0xf0; ret = max9286_read(priv, 0x49);
if (ret < 0) if (ret < 0)
return -EIO; return -EIO;
ret &= 0xf0;
if (ret == conflink_mask) if (ret == conflink_mask)
break; break;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册