netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Lemon <jonathan.lemon@gmail.com>
To: Nathan Chancellor <nathan@kernel.org>
Cc: Richard Cochran <richardcochran@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	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: Thu, 16 Sep 2021 22:41:14 -0700	[thread overview]
Message-ID: <20210917054114.u7ivmjfdsw7ta72m@bsd-mbp.dhcp.thefacebook.com> (raw)
In-Reply-To: <20210917045204.1385801-1-nathan@kernel.org>

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>

  reply	other threads:[~2021-09-17  5:41 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 [this message]
2021-09-17 17:32   ` Jakub Kicinski

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=20210917054114.u7ivmjfdsw7ta72m@bsd-mbp.dhcp.thefacebook.com \
    --to=jonathan.lemon@gmail.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).