From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Hans Verkuil <hverkuil@xs4all.nl>
Cc: Linux Media Mailing List <linux-media@vger.kernel.org>,
Sakari Ailus <sakari.ailus@linux.intel.com>
Subject: Re: [PATCH for v5.6] mc-entity.c: use & to check pad flags, not ==
Date: Tue, 4 Feb 2020 20:23:55 +0200 [thread overview]
Message-ID: <20200204182355.GD20396@pendragon.ideasonboard.com> (raw)
In-Reply-To: <ac1e8940-91c6-b07c-e3ae-55f32931f9c1@xs4all.nl>
Hi Hans,
Thank you for the patch.
On Tue, Feb 04, 2020 at 07:19:22PM +0100, Hans Verkuil wrote:
> 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 <hverkuil-cisco@xs4all.nl>
> Cc: <stable@vger.kernel.org> # for v5.3 and up
> ---
> diff --git a/drivers/media/mc/mc-entity.c b/drivers/media/mc/mc-entity.c
> index 7c429ce98bae..0f1461ac00f0 100644
> --- a/drivers/media/mc/mc-entity.c
> +++ b/drivers/media/mc/mc-entity.c
> @@ -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)
What if MEDIA_PAD_FL_SINK and MEDIA_PAD_FL_SOURCE are both set ? Is that
acceptable ?
> pad_is_sink = false;
> else
> continue; /* This is an error! */
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2020-02-04 18:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-04 18:19 [PATCH for v5.6] mc-entity.c: use & to check pad flags, not == Hans Verkuil
2020-02-04 18:23 ` Laurent Pinchart [this message]
2020-02-04 18:32 ` Hans Verkuil
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200204182355.GD20396@pendragon.ideasonboard.com \
--to=laurent.pinchart@ideasonboard.com \
--cc=hverkuil@xs4all.nl \
--cc=linux-media@vger.kernel.org \
--cc=sakari.ailus@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.