]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
media: mc: fix endpoint iteration
authorCosmin Tanislav <demonsingur@gmail.com>
Fri, 22 Nov 2024 14:55:24 +0000 (16:55 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Thu, 19 Dec 2024 11:50:17 +0000 (12:50 +0100)
When creating links from a subdev to a sink, the current logic tries to
iterate over the endpoints of dev's fwnode.

This might not be correct when the subdev uses a different fwnode
compared to the dev's fwnode.

If, when registering, the subdev's fwnode is not set, the code inside
v4l2_async_register_subdev will set it to the dev's fwnode.

To fix this, just use the subdev's fwnode.

Signed-off-by: Cosmin Tanislav <demonsingur@gmail.com>
Fixes: 0d3c81e82da9 ("media: v4l2-mc: add v4l2_create_fwnode_links helpers")
Cc: stable@vger.kernel.org
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/media/v4l2-core/v4l2-mc.c

index 4bb91359e3a9a7f6c5477668ddf13cf49f85e73c..937d358697e19af88666dc2d8927b521090add2f 100644 (file)
@@ -329,7 +329,7 @@ int v4l2_create_fwnode_links_to_pad(struct v4l2_subdev *src_sd,
        if (!(sink->flags & MEDIA_PAD_FL_SINK))
                return -EINVAL;
 
-       fwnode_graph_for_each_endpoint(dev_fwnode(src_sd->dev), endpoint) {
+       fwnode_graph_for_each_endpoint(src_sd->fwnode, endpoint) {
                struct fwnode_handle *remote_ep;
                int src_idx, sink_idx, ret;
                struct media_pad *src;