Skip to content

Commit 044041c

Browse files
Hans Verkuilmchehab
authored andcommitted
media: mc-entity.c: use & to check pad flags, not ==
These are bits so to test if a pad is a sink you use & but not ==. It looks like the only reason this hasn't caused problems before is that media_get_pad_index() is currently only used with pads that do not set the MEDIA_PAD_FL_MUST_CONNECT flag. So a pad really had only the SINK or SOURCE flag set and nothing else. Signed-off-by: Hans Verkuil <[email protected]> Cc: <[email protected]> # for v5.3 and up Signed-off-by: Mauro Carvalho Chehab <[email protected]>
1 parent 316e730 commit 044041c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/media/mc/mc-entity.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -639,9 +639,9 @@ int media_get_pad_index(struct media_entity *entity, bool is_sink,
639639
return -EINVAL;
640640

641641
for (i = 0; i < entity->num_pads; i++) {
642-
if (entity->pads[i].flags == MEDIA_PAD_FL_SINK)
642+
if (entity->pads[i].flags & MEDIA_PAD_FL_SINK)
643643
pad_is_sink = true;
644-
else if (entity->pads[i].flags == MEDIA_PAD_FL_SOURCE)
644+
else if (entity->pads[i].flags & MEDIA_PAD_FL_SOURCE)
645645
pad_is_sink = false;
646646
else
647647
continue; /* This is an error! */

0 commit comments

Comments
 (0)