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)
commit989bea48915861171421bd6e1367bf4c9407513d
tree7b920aa000b8c970efe5ff2c3c0c3d74cfd233ea
parent7daaf0bc24ad81ec13b444a047cf4f66827ba96e
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