]> git.baikalelectronics.ru Git - kernel.git/commit
media: cedrus: fix various format-related compliance issues
authorHans Verkuil <hverkuil-cisco@xs4all.nl>
Fri, 30 Aug 2019 09:26:24 +0000 (06:26 -0300)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Tue, 1 Oct 2019 19:40:53 +0000 (16:40 -0300)
commit37c2ef542145a7cb6eb6c391afbd8e0c6c35d60f
tree80598535d07246b8b833402b5fbe552b6d51a488
parent97c1ceefbe1db0b64523ece9d23edffd2e7298ef
media: cedrus: fix various format-related compliance issues

Initialize the context on open() with valid capture and output
formats. It is good practice to always have valid formats internally.

This solves one vb2 warning in the kernel log where the sizeimage
value of the output format was 0 when requesting buffers, which is
not allowed.

It also simplifies the g_fmt ioctl implementations since they no longer
have to check if a valid format was ever set.

cedrus_prepare_format() now also validates sizeimage for the output
formats, ensuring userspace can't set it to 0 since that would cause
the same vb2 warning.

Finally remove the sizeimage == 0 check in cedrus_try_fmt_vid_out()
since cedrus_prepare_format() will now adjust this value.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Reviewed-by: Jernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/staging/media/sunxi/cedrus/cedrus.c
drivers/staging/media/sunxi/cedrus/cedrus_video.c
drivers/staging/media/sunxi/cedrus/cedrus_video.h