a99a52983117fc2808eb1c4172589f08df9d7cb0
[openwrt/staging/blogic.git] /
1 From 74a4bd2caa37f07786cdf3e86ad9f7cbc6977b31 Mon Sep 17 00:00:00 2001
2 From: Daniel Scally <djrscally@gmail.com>
3 Date: Wed, 2 Mar 2022 22:03:00 +0000
4 Subject: [PATCH] media: entity: Skip non-data links in graph iteration
5
6 When iterating over the media graph, don't follow links that are not
7 data links.
8
9 Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
10 Signed-off-by: Daniel Scally <djrscally@gmail.com>
11 ---
12 drivers/media/mc/mc-entity.c | 6 ++++++
13 1 file changed, 6 insertions(+)
14
15 --- a/drivers/media/mc/mc-entity.c
16 +++ b/drivers/media/mc/mc-entity.c
17 @@ -313,6 +313,12 @@ static void media_graph_walk_iter(struct
18
19 link = list_entry(link_top(graph), typeof(*link), list);
20
21 + /* If the link is not a data link, don't follow it */
22 + if ((link->flags & MEDIA_LNK_FL_LINK_TYPE) != MEDIA_LNK_FL_DATA_LINK) {
23 + link_top(graph) = link_top(graph)->next;
24 + return;
25 + }
26 +
27 /* The link is not enabled so we do not follow. */
28 if (!(link->flags & MEDIA_LNK_FL_ENABLED)) {
29 link_top(graph) = link_top(graph)->next;