media: staging: atomisp: reduce kernel stack usage
authorArnd Bergmann <arnd@arndb.de>
Fri, 26 Feb 2021 14:05:02 +0000 (15:05 +0100)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Tue, 23 Mar 2021 15:55:52 +0000 (16:55 +0100)
commit97b34809ec240d82c82af97626c2071a4062e0e6
tree454f9c902e7a3ac12a0cc14dba4179af4c7fd0b6
parent21ad53f206a95eda09a7b3780fb2f0b30ded314a
media: staging: atomisp: reduce kernel stack usage

The atomisp_set_fmt() function has multiple copies of the large
v4l2_format structure on its stack, resulting in a warning about
excessive stack usage in some rare randconfig builds.

drivers/staging/media/atomisp/pci/atomisp_cmd.c:5600:5: error: stack frame size of 1084 bytes in function 'atomisp_set_fmt' [-Werror,-Wframe-larger-than=]

Of this structure, only three members in the 'fmt.pix' member are
used, so simplify it by using the smaller v4l2_pix_format structure
directly. This reduces the stack usage to 612 bytes, and it could
be reduced further by only storing the three members that are used.

Link: https://lore.kernel.org/linux-media/20210226140524.3478346-1-arnd@kernel.org
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/staging/media/atomisp/pci/atomisp_cmd.c
drivers/staging/media/atomisp/pci/atomisp_cmd.h
drivers/staging/media/atomisp/pci/atomisp_ioctl.c