All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Jonathan Lemon <jonathan.lemon@gmail.com>,
	Nathan Chancellor <nathan@kernel.org>
Cc: Richard Cochran <richardcochran@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	llvm@lists.linux.dev
Subject: Re: [PATCH net-next v2] ptp: ocp: Avoid operator precedence warning in ptp_ocp_summary_show()
Date: Fri, 17 Sep 2021 10:32:43 -0700	[thread overview]
Message-ID: <20210917103243.560c1777@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> (raw)
In-Reply-To: <20210917054114.u7ivmjfdsw7ta72m@bsd-mbp.dhcp.thefacebook.com>

On Thu, 16 Sep 2021 22:41:14 -0700 Jonathan Lemon wrote:
> On Thu, Sep 16, 2021 at 09:52:05PM -0700, Nathan Chancellor wrote:
> > Clang warns twice:
> > 
> > drivers/ptp/ptp_ocp.c:2065:16: error: operator '?:' has lower precedence
> > than '&'; '&' will be evaluated first
> > [-Werror,-Wbitwise-conditional-parentheses]
> >                            on & map ? " ON" : "OFF", src);
> >                            ~~~~~~~~ ^
> > drivers/ptp/ptp_ocp.c:2065:16: note: place parentheses around the '&'
> > expression to silence this warning
> >                            on & map ? " ON" : "OFF", src);
> >                                     ^
> >                            (       )
> > drivers/ptp/ptp_ocp.c:2065:16: note: place parentheses around the '?:'
> > expression to evaluate it first
> >                            on & map ? " ON" : "OFF", src);
> >                                     ^
> > 
> > on and map are both booleans so this should be a logical AND, which
> > clears up the operator precedence issue.
> > 
> > Fixes: a62a56d04e63 ("ptp: ocp: Enable 4th timestamper / PPS generator")
> > Link: https://github.com/ClangBuiltLinux/linux/issues/1457
> > Suggested-by: Jonathan Lemon <jonathan.lemon@gmail.com>
> > Signed-off-by: Nathan Chancellor <nathan@kernel.org>  
> 
> Acked-by: Jonathan Lemon <jonathan.lemon@gmail.com>

Applied, thanks!

      reply	other threads:[~2021-09-17 17:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-17  4:52 [PATCH net-next v2] ptp: ocp: Avoid operator precedence warning in ptp_ocp_summary_show() Nathan Chancellor
2021-09-17  5:41 ` Jonathan Lemon
2021-09-17 17:32   ` Jakub Kicinski [this message]

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=20210917103243.560c1777@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com \
    --to=kuba@kernel.org \
    --cc=davem@davemloft.net \
    --cc=jonathan.lemon@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=nathan@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=richardcochran@gmail.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.