media: atomisp: fix querycap initialization logic
authorMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Sat, 2 May 2020 16:15:48 +0000 (18:15 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Wed, 20 May 2020 10:32:20 +0000 (12:32 +0200)
commit8ac171401531a18016c3eb8258a6316aef65047b
tree7e6d8389260c58f26307659133aa0b42f9df6c8d
parentac378c94c7c6b2af7ad4afdb4c97f37976cdcc5b
media: atomisp: fix querycap initialization logic

Some recent changes at V4L2 core changed the way querycap is handled.

Due to that, this warning is generated:

WARNING: CPU: 1 PID: 503 at drivers/media/v4l2-core/v4l2-dev.c:885 __video_register_device+0x93e/0x1120 [videodev]

as introduced by this commit:

commit 3c1350501c21db8e3b1a38d9e97db29694305c3b
Author: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Date:   Tue Jul 23 04:21:25 2019 -0400

    media: v4l2-dev/ioctl: require non-zero device_caps, verify sane querycap results

    Now that all V4L2 drivers set device_caps in struct video_device, we can add
    a check for this to ensure all future drivers fill this in.

The fix is simple: we just need to initialize dev_caps before
registering the V4L2 dev.

While here, solve other problems at VIDIOC_QUERYCAP ioctl.

Reported-by: Patrik Gfeller <patrik.gfeller@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/staging/media/atomisp/pci/atomisp_ioctl.c
drivers/staging/media/atomisp/pci/atomisp_subdev.c
drivers/staging/media/atomisp/pci/atomisp_v4l2.c
drivers/staging/media/atomisp/pci/atomisp_v4l2.h