Commit 5314161a authored by Hans Verkuil's avatar Hans Verkuil Committed by Ezequiel Garcia
Browse files

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: default avatarHans Verkuil <>
Cc: <>      # for v5.3 and up
parent 807cc1f0
......@@ -639,9 +639,9 @@ int media_get_pad_index(struct media_entity *entity, bool is_sink,
return -EINVAL;
for (i = 0; i < entity->num_pads; i++) {
if (entity->pads[i].flags == MEDIA_PAD_FL_SINK)
if (entity->pads[i].flags & MEDIA_PAD_FL_SINK)
pad_is_sink = true;
else if (entity->pads[i].flags == MEDIA_PAD_FL_SOURCE)
else if (entity->pads[i].flags & MEDIA_PAD_FL_SOURCE)
pad_is_sink = false;
continue; /* This is an error! */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment