diff options
author | Paul Kocialkowski <paul.kocialkowski@bootlin.com> | 2019-07-25 14:55:59 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab+samsung@kernel.org> | 2019-07-30 12:13:15 -0400 |
commit | 1e42d384aa19e06410be52bd05cfc159722c0b7f (patch) | |
tree | e11e3a8986098612e0fd773b76aa591c35e8dffe | |
parent | 4b4d62b03191700f3245941146a8510d31ec66b3 (diff) |
media: v4l2-ctrl: Add a comment on why we zero out compound controls fields
Since it's not necessarily very explicit why we need to zero some fields
in std_validate_compound, add a comment before the function to explain
why, which should help as a reminder.
Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
-rw-r--r-- | drivers/media/v4l2-core/v4l2-ctrls.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c index 76fa2db0e8fb..cd1ae016706f 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls.c +++ b/drivers/media/v4l2-core/v4l2-ctrls.c @@ -1645,6 +1645,10 @@ static void std_log(const struct v4l2_ctrl *ctrl) #define zero_padding(s) \ memset(&(s).padding, 0, sizeof((s).padding)) +/* + * Compound controls validation requires setting unused fields/flags to zero + * in order to properly detect unchanged controls with std_equal's memcmp. + */ static int std_validate_compound(const struct v4l2_ctrl *ctrl, u32 idx, union v4l2_ctrl_ptr ptr) { |