Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

media: v4l-common: Make v4l2_find_nearest_size more sparse-friendly

This sparse warning is emitted by using v4l2_find_nearest_size in some
cases. Fix it in the framework.

>> drivers/media/i2c/ov5640.c:1394:14: sparse: incorrect type in assignment
+(different base types) @@ expected struct ov5640_mode_info const *mode @@
+got ststruct ov5640_mode_info const *mode @@
drivers/media/i2c/ov5640.c:1394:14: expected struct ov5640_mode_info const
+*mode
drivers/media/i2c/ov5640.c:1394:14: got struct ov5640_mode_info const ( *<
+noident> )[9]

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>

authored by

Sakari Ailus and committed by
Mauro Carvalho Chehab
2bbc46e8 41cb1c73

+1 -1
+1 -1
include/media/v4l2-common.h
··· 338 338 ({ \ 339 339 BUILD_BUG_ON(sizeof((array)->width_field) != sizeof(u32) || \ 340 340 sizeof((array)->height_field) != sizeof(u32)); \ 341 - (typeof(&(*(array))))__v4l2_find_nearest_size( \ 341 + (typeof(&(array)[0]))__v4l2_find_nearest_size( \ 342 342 (array), array_size, sizeof(*(array)), \ 343 343 offsetof(typeof(*(array)), width_field), \ 344 344 offsetof(typeof(*(array)), height_field), \