summaryrefslogtreecommitdiff
path: root/drivers/staging/media/atomisp/i2c/ov5693
diff options
context:
space:
mode:
authorYizhuo <yzhai003@ucr.edu>2021-07-11 22:23:32 +0200
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>2021-09-30 10:07:44 +0200
commit5ba9c067b5ed1ccfec58acae07c6582f16b9d44b (patch)
treec0bee2841ee614d20eadceac399057df304a34b3 /drivers/staging/media/atomisp/i2c/ov5693
parente16f5e39acd6d10cc63ae39bc0a77188ed828f22 (diff)
media: staging: atomisp: fix the uninitialized use in gc2235_detect()
Inside function gc2235_detect(), variable "low" could be uninitialized if ov5693_read_reg() returns error, however, it affects the value of variable "id". The "id" is used in the later if statement, which is potentially unsafe. Link: https://lore.kernel.org/linux-media/20210711202334.27959-1-yzhai003@ucr.edu Signed-off-by: Yizhuo <yzhai003@ucr.edu> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Diffstat (limited to 'drivers/staging/media/atomisp/i2c/ov5693')
-rw-r--r--drivers/staging/media/atomisp/i2c/ov5693/atomisp-ov5693.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/staging/media/atomisp/i2c/ov5693/atomisp-ov5693.c b/drivers/staging/media/atomisp/i2c/ov5693/atomisp-ov5693.c
index 5e3670c4fc29..6c95f57a52e9 100644
--- a/drivers/staging/media/atomisp/i2c/ov5693/atomisp-ov5693.c
+++ b/drivers/staging/media/atomisp/i2c/ov5693/atomisp-ov5693.c
@@ -1714,6 +1714,8 @@ static int ov5693_detect(struct i2c_client *client)
}
ret = ov5693_read_reg(client, OV5693_8BIT,
OV5693_SC_CMMN_CHIP_ID_L, &low);
+ if (ret)
+ return ret;
id = ((((u16)high) << 8) | (u16)low);
if (id != OV5693_ID) {