@@ -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:
@@ -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
*
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@skidata.com> --- drivers/media/v4l2-core/v4l2-cci.c | 5 ++++- include/media/v4l2-cci.h | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-)