]> git.baikalelectronics.ru Git - kernel.git/commit
ptp: ocp: Avoid operator precedence warning in ptp_ocp_summary_show()
authorNathan Chancellor <nathan@kernel.org>
Fri, 17 Sep 2021 04:52:05 +0000 (21:52 -0700)
committerJakub Kicinski <kuba@kernel.org>
Fri, 17 Sep 2021 17:32:08 +0000 (10:32 -0700)
commitfddaeb3e6962b1ca4d1d18b662e41964b7c4d27d
treea1d56173353244c978dd0dd6ce1d0292079884ef
parentac0e155b00d98ee0114ede9a8e4da433a5b6b129
ptp: ocp: Avoid operator precedence warning in ptp_ocp_summary_show()

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: 90677cf01c9d ("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>
Link: https://lore.kernel.org/r/20210917045204.1385801-1-nathan@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/ptp/ptp_ocp.c