]> git.baikalelectronics.ru Git - kernel.git/commit
media: v4l: subdev: Set sd->devnode before registering the subdev
authorSakari Ailus <sakari.ailus@linux.intel.com>
Thu, 15 Aug 2019 07:36:49 +0000 (09:36 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Wed, 2 Dec 2020 14:55:44 +0000 (15:55 +0100)
commit7a190dadc89875067ecc14c66a5b004e425d1639
tree7b920aa000b8c970efe5ff2c3c0c3d74cfd233ea
parent11ef8820c85ba078dfe16ce92ca43eb35f96e204
media: v4l: subdev: Set sd->devnode before registering the subdev

The subdev's video device node was only assigned after registering the
device node in the system. While it is unlikely that a driver needed to
use this field in handling system calls to its file handle, there remains
a slim chance the devnode field remains NULL while the driver expects to
find a video node there.

Assign the devnode field before registering the device, and assign it back
to NULL if the registration failed.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/media/v4l2-core/v4l2-device.c