summaryrefslogtreecommitdiff
path: root/drivers/media
diff options
context:
space:
mode:
authorYuanjun Gong <ruc_gongyuanjun@163.com>2023-07-25 06:35:13 +0300
committerMauro Carvalho Chehab <mchehab@kernel.org>2023-08-10 08:58:36 +0300
commit7b7a3c014ed6bda5c37f7a95ad684796dc26c9a5 (patch)
treef2c420d04682c80ba40636f15a9aa2f4d34bbec2 /drivers/media
parent992ba89d0300d943811e996c6fd36d6979dcf273 (diff)
downloadlinux-7b7a3c014ed6bda5c37f7a95ad684796dc26c9a5.tar.xz
media: dvb: mb86a16: check the return value of mb86a16_read()
return an error code if mb86a16_read() gets an unexpected return value. Signed-off-by: Yuanjun Gong <ruc_gongyuanjun@163.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> [hverkuil: add {} around the else statement]
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/dvb-frontends/mb86a16.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/media/dvb-frontends/mb86a16.c b/drivers/media/dvb-frontends/mb86a16.c
index d3e29937cf4c..3ec2cb4fa504 100644
--- a/drivers/media/dvb-frontends/mb86a16.c
+++ b/drivers/media/dvb-frontends/mb86a16.c
@@ -1487,10 +1487,12 @@ static int mb86a16_set_fe(struct mb86a16_state *state)
}
}
- mb86a16_read(state, 0x15, &agcval);
- mb86a16_read(state, 0x26, &cnmval);
- dprintk(verbose, MB86A16_INFO, 1, "AGC = %02x CNM = %02x", agcval, cnmval);
-
+ if (mb86a16_read(state, 0x15, &agcval) != 2 || mb86a16_read(state, 0x26, &cnmval) != 2) {
+ dprintk(verbose, MB86A16_ERROR, 1, "I2C transfer error");
+ ret = -EREMOTEIO;
+ } else {
+ dprintk(verbose, MB86A16_INFO, 1, "AGC = %02x CNM = %02x", agcval, cnmval);
+ }
return ret;
}