From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.3 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1B9CAC35247 for ; Tue, 4 Feb 2020 18:24:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CC85A20674 for ; Tue, 4 Feb 2020 18:24:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="oN7tszKM" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727415AbgBDSYO (ORCPT ); Tue, 4 Feb 2020 13:24:14 -0500 Received: from perceval.ideasonboard.com ([213.167.242.64]:50414 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727359AbgBDSYO (ORCPT ); Tue, 4 Feb 2020 13:24:14 -0500 Received: from pendragon.ideasonboard.com (64.177-245-81.adsl-dyn.isp.belgacom.be [81.245.177.64]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 42D76A58; Tue, 4 Feb 2020 19:24:12 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1580840652; bh=zFTGFSo/WAbNQNNcicSOhOMizabwjgIxq1c8MgbFkec=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=oN7tszKMI2XHQb5w0TU8eJwAzTY7SXN3mQgwVdK6DIQg9RCaEqlb7i14WLb+qBLRI 9vr/i4+0dteEiA1OqpMl7qRcnbSXrCKkxhcidNg3ItN/7lMMWDyp8CwMiYP6PKFIZS R/6Q2txSCdcPWIedgNEQDU+p1WWsTbccaVCVRJYY= Date: Tue, 4 Feb 2020 20:23:55 +0200 From: Laurent Pinchart To: Hans Verkuil Cc: Linux Media Mailing List , Sakari Ailus Subject: Re: [PATCH for v5.6] mc-entity.c: use & to check pad flags, not == Message-ID: <20200204182355.GD20396@pendragon.ideasonboard.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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 > Cc: # 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