[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20210917103243.560c1777@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
Date: Fri, 17 Sep 2021 10:32:43 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Jonathan Lemon <jonathan.lemon@...il.com>,
Nathan Chancellor <nathan@...nel.org>
Cc: Richard Cochran <richardcochran@...il.com>,
"David S. Miller" <davem@...emloft.net>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, llvm@...ts.linux.dev
Subject: Re: [PATCH net-next v2] ptp: ocp: Avoid operator precedence warning
in ptp_ocp_summary_show()
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@...il.com>
> > Signed-off-by: Nathan Chancellor <nathan@...nel.org>
>
> Acked-by: Jonathan Lemon <jonathan.lemon@...il.com>
Applied, thanks!
Powered by blists - more mailing lists