[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240211150749.3832-1-d.dulov@aladdin.ru>
Date: Sun, 11 Feb 2024 07:07:48 -0800
From: Daniil Dulov <d.dulov@...ddin.ru>
To: Mauro Carvalho Chehab <mchehab@...nel.org>
CC: Daniil Dulov <d.dulov@...ddin.ru>, Hans Verkuil <hverkuil@...all.nl>,
Takahiro Adachi <tadachi@...achi-net.com>, Takeru Komoriya
<komoriya@...en.org>, <linux-media@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <lvc-project@...uxtesting.org>
Subject: [PATCH 17/17] media: upd64031a: Check return value of i2c_master_recv()
i2c_master_recv() may return an error, so add a check
and return 0xff in case it is passed.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Fixes: add953cecba8 ("V4L/DVB (3665): Add new NEC uPD64031A and uPD64083 i2c drivers")
Signed-off-by: Daniil Dulov <d.dulov@...ddin.ru>
---
drivers/media/i2c/upd64031a.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/media/i2c/upd64031a.c b/drivers/media/i2c/upd64031a.c
index ef35c6574785..f51f86f30c73 100644
--- a/drivers/media/i2c/upd64031a.c
+++ b/drivers/media/i2c/upd64031a.c
@@ -73,11 +73,12 @@ static u8 upd64031a_read(struct v4l2_subdev *sd, u8 reg)
{
struct i2c_client *client = v4l2_get_subdevdata(sd);
u8 buf[2];
+ int rc;
if (reg >= sizeof(buf))
return 0xff;
- i2c_master_recv(client, buf, 2);
- return buf[reg];
+ rc = i2c_master_recv(client, buf, 2);
+ return rc < 0 ? 0xff : buf[reg];
}
/* ------------------------------------------------------------------------ */
--
2.25.1
Powered by blists - more mailing lists