提交 db0f4691 编写于 作者: S Sebastian Reichel 提交者: Mauro Carvalho Chehab

[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: NSebastian Reichel <sre@kernel.org>
Signed-off-by: NIvaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
Signed-off-by: NPavel Machek <pavel@ucw.cz>
Signed-off-by: NSakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: NMauro Carvalho Chehab <mchehab@s-opensource.com>
上级 974f4a38
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册