mirror of
https://github.com/torvalds/linux.git
synced 2024-11-11 22:51:42 +00:00
[media] v4l: Allow calling v4l2_device_register_subdev_nodes() multiple times
Previously multiple calls to v4l2_device_register_subdev_nodes() ended up corrupting memory and leaking some, too. This patch changes the behaviour so that sub-devices the device nodes of which are already registered are ignored. Signed-off-by: Sebastian Reichel <sre@kernel.org> Signed-off-by: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com> Signed-off-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
This commit is contained in:
parent
974f4a385c
commit
db0f4691d9
@ -235,6 +235,9 @@ int v4l2_device_register_subdev_nodes(struct v4l2_device *v4l2_dev)
|
||||
if (!(sd->flags & V4L2_SUBDEV_FL_HAS_DEVNODE))
|
||||
continue;
|
||||
|
||||
if (sd->devnode)
|
||||
continue;
|
||||
|
||||
vdev = kzalloc(sizeof(*vdev), GFP_KERNEL);
|
||||
if (!vdev) {
|
||||
err = -ENOMEM;
|
||||
|
Loading…
Reference in New Issue
Block a user