diff options
author | Sakari Ailus <sakari.ailus@linux.intel.com> | 2024-05-28 14:00:51 +0300 |
---|---|---|
committer | Hans Verkuil <hverkuil-cisco@xs4all.nl> | 2024-06-04 08:31:25 +0200 |
commit | 7417b1b1f36cc214dc458e717278a27a912d3b51 (patch) | |
tree | 89183498ff60a83ae55f55e9ad91260c03a3c88a | |
parent | da1d582aa7e349dd46351f2168911d2f0e058e9f (diff) | |
download | linux-7417b1b1f36cc214dc458e717278a27a912d3b51.tar.gz linux-7417b1b1f36cc214dc458e717278a27a912d3b51.tar.bz2 linux-7417b1b1f36cc214dc458e717278a27a912d3b51.zip |
media: v4l2-cci: Always assign *val
Always assign *val to 0 in cci_read(). This has the benefit of not
requiring initialisation of the variables data is read to using
cci_read(). Once smatch is fixed, it could catch the use of uninitialised
reads.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Tested-by: Benjamin Mugnier <benjamin.mugnier@foss.st.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
-rw-r--r-- | drivers/media/v4l2-core/v4l2-cci.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/media/v4l2-core/v4l2-cci.c b/drivers/media/v4l2-core/v4l2-cci.c index ee3475bed37f..1ff94affbaf3 100644 --- a/drivers/media/v4l2-core/v4l2-cci.c +++ b/drivers/media/v4l2-core/v4l2-cci.c @@ -23,6 +23,15 @@ int cci_read(struct regmap *map, u32 reg, u64 *val, int *err) u8 buf[8]; int ret; + /* + * TODO: Fix smatch. Assign *val to 0 here in order to avoid + * failing a smatch check on caller when the caller proceeds to + * read *val without initialising it on caller's side. *val is set + * to a valid value whenever this function returns 0 but smatch + * can't figure that out currently. + */ + *val = 0; + if (err && *err) return *err; |