summaryrefslogtreecommitdiffstats
path: root/drivers/media/i2c/max9286.c
diff options
context:
space:
mode:
authorColin Ian King <colin.king@canonical.com>2020-07-20 18:13:35 +0200
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>2020-09-01 14:13:27 +0200
commite5b95c8febd504659b60a7601fd43c0ae8e4f3c0 (patch)
tree09393c84dd06256563f1767e418fa8859e23fe39 /drivers/media/i2c/max9286.c
parent4eb5928dbfff2f252d8bca7ec4c4ca0890da0927 (diff)
downloadlinux-e5b95c8febd504659b60a7601fd43c0ae8e4f3c0.tar.bz2
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: 66d8c9d2422d ("media: i2c: Add MAX9286 driver") Signed-off-by: Colin Ian King <colin.king@canonical.com> Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Diffstat (limited to 'drivers/media/i2c/max9286.c')
-rw-r--r--drivers/media/i2c/max9286.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/media/i2c/max9286.c b/drivers/media/i2c/max9286.c
index 47f280518fdb..b364a3f60486 100644
--- a/drivers/media/i2c/max9286.c
+++ b/drivers/media/i2c/max9286.c
@@ -405,10 +405,11 @@ static int max9286_check_config_link(struct max9286_priv *priv,
* to 5 milliseconds.
*/
for (i = 0; i < 10; i++) {
- ret = max9286_read(priv, 0x49) & 0xf0;
+ ret = max9286_read(priv, 0x49);
if (ret < 0)
return -EIO;
+ ret &= 0xf0;
if (ret == conflink_mask)
break;