diff mbox series

media: video-mux: Skip dangling endpoints

Message ID 20210322144408.31461-1-p.zabel@pengutronix.de (mailing list archive)
State New, archived
Headers show
Series media: video-mux: Skip dangling endpoints | expand

Commit Message

Philipp Zabel March 22, 2021, 2:44 p.m. UTC
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>
---
 drivers/media/platform/video-mux.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

Comments

Fabio Estevam March 22, 2021, 3:07 p.m. UTC | #1
Hi Philipp,

On Mon, Mar 22, 2021 at 11:44 AM Philipp Zabel <p.zabel@pengutronix.de> wrote:
>
> 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>

With your patch applied, I don't see the video-mux probe error anymore:

Reported-and-tested-by: Fabio Estevam <festevam@gmail.com>

It would be nice to add a Fixes tag too, so that it can be applied as
a fix for the final 5.12.

Thanks
diff mbox series

Patch

diff --git a/drivers/media/platform/video-mux.c b/drivers/media/platform/video-mux.c
index 133122e38515..9bc0b4d8de09 100644
--- a/drivers/media/platform/video-mux.c
+++ b/drivers/media/platform/video-mux.c
@@ -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);