[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240807-imx290-avail-v1-1-666c130c7601@skidata.com>
Date: Wed, 07 Aug 2024 10:10:27 +0200
From: Benjamin Bara <bbara93@...il.com>
To: Mauro Carvalho Chehab <mchehab@...nel.org>,
Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>,
Sakari Ailus <sakari.ailus@...ux.intel.com>
Cc: Hans de Goede <hdegoede@...hat.com>,
Laurent Pinchart <laurent.pinchart@...asonboard.com>,
linux-media@...r.kernel.org, linux-kernel@...r.kernel.org,
Benjamin Bara <benjamin.bara@...data.com>
Subject: [PATCH 1/2] media: v4l2-cci: Allow "empty read"
Make the read pointer optional for cases where only the return value is
of interest. This could be the case for availability checks during
probe().
Signed-off-by: Benjamin Bara <benjamin.bara@...data.com>
---
drivers/media/v4l2-core/v4l2-cci.c | 5 ++++-
include/media/v4l2-cci.h | 2 +-
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/media/v4l2-core/v4l2-cci.c b/drivers/media/v4l2-core/v4l2-cci.c
index 1ff94affbaf3..c402e0377a57 100644
--- a/drivers/media/v4l2-core/v4l2-cci.c
+++ b/drivers/media/v4l2-core/v4l2-cci.c
@@ -30,7 +30,8 @@ int cci_read(struct regmap *map, u32 reg, u64 *val, int *err)
* to a valid value whenever this function returns 0 but smatch
* can't figure that out currently.
*/
- *val = 0;
+ if (val)
+ *val = 0;
if (err && *err)
return *err;
@@ -45,6 +46,8 @@ int cci_read(struct regmap *map, u32 reg, u64 *val, int *err)
reg, ret);
goto out;
}
+ if (!val)
+ goto out;
switch (len) {
case 1:
diff --git a/include/media/v4l2-cci.h b/include/media/v4l2-cci.h
index 4e96e90ee636..ef5e0d875e68 100644
--- a/include/media/v4l2-cci.h
+++ b/include/media/v4l2-cci.h
@@ -60,7 +60,7 @@ struct cci_reg_sequence {
*
* @map: Register map to read from
* @reg: Register address to read, use CCI_REG#() macros to encode reg width
- * @val: Pointer to store read value
+ * @val: Optional pointer to store read value
* @err: Optional pointer to store errors, if a previous error is set
* then the read will be skipped
*
--
2.46.0
Powered by blists - more mailing lists