Message ID | 20201127100526.27652-1-sakari.ailus@linux.intel.com |
---|---|
State | Accepted |
Commit | 989bea48915861171421bd6e1367bf4c9407513d |
Headers | show |
Series | [v2,1/1] v4l: subdev: Set sd->devnode before registering the subdev | expand |
diff --git a/drivers/media/v4l2-core/v4l2-device.c b/drivers/media/v4l2-core/v4l2-device.c index de4287251a89..d2e58ae91f9b 100644 --- a/drivers/media/v4l2-core/v4l2-device.c +++ b/drivers/media/v4l2-core/v4l2-device.c @@ -218,13 +218,14 @@ int __v4l2_device_register_subdev_nodes(struct v4l2_device *v4l2_dev, vdev->ctrl_handler = sd->ctrl_handler; if (read_only) set_bit(V4L2_FL_SUBDEV_RO_DEVNODE, &vdev->flags); + sd->devnode = vdev; err = __video_register_device(vdev, VFL_TYPE_SUBDEV, -1, 1, sd->owner); if (err < 0) { + sd->devnode = NULL; kfree(vdev); goto clean_up; } - sd->devnode = vdev; #if defined(CONFIG_MEDIA_CONTROLLER) sd->entity.info.dev.major = VIDEO_MAJOR; sd->entity.info.dev.minor = vdev->minor;