]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
media: video-mux: Skip dangling endpoints
authorPhilipp Zabel <p.zabel@pengutronix.de>
Mon, 22 Mar 2021 14:44:08 +0000 (15:44 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 14 Jul 2021 14:59:39 +0000 (16:59 +0200)
[ Upstream commit 95778c2d0979618e3349b1d2324ec282a5a6adbf ]

i.MX6 device tree include files contain dangling endpoints for the
board device tree writers' convenience. These are still included in
many existing device trees.
Treat dangling endpoints as non-existent to support them.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Fixes: 612b385efb1e ("media: video-mux: Create media links in bound notifier")
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/media/platform/video-mux.c

index 133122e3851503118c9f999dfac36d7ca42684fe..9bc0b4d8de0956498f59836ad80ff5c33ddb3ca1 100644 (file)
@@ -362,7 +362,7 @@ static int video_mux_async_register(struct video_mux *vmux,
 
        for (i = 0; i < num_input_pads; i++) {
                struct v4l2_async_subdev *asd;
-               struct fwnode_handle *ep;
+               struct fwnode_handle *ep, *remote_ep;
 
                ep = fwnode_graph_get_endpoint_by_id(
                        dev_fwnode(vmux->subdev.dev), i, 0,
@@ -370,6 +370,14 @@ static int video_mux_async_register(struct video_mux *vmux,
                if (!ep)
                        continue;
 
+               /* Skip dangling endpoints for backwards compatibility */
+               remote_ep = fwnode_graph_get_remote_endpoint(ep);
+               if (!remote_ep) {
+                       fwnode_handle_put(ep);
+                       continue;
+               }
+               fwnode_handle_put(remote_ep);
+
                asd = v4l2_async_notifier_add_fwnode_remote_subdev(
                        &vmux->notifier, ep, struct v4l2_async_subdev);