]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
misc: echo: Remove unnecessary parentheses and simplify check for zero
authorNathan Chancellor <natechancellor@gmail.com>
Sat, 15 Sep 2018 06:43:37 +0000 (23:43 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 25 Sep 2018 18:21:02 +0000 (20:21 +0200)
Clang warns when multiple pairs of parentheses are used for a single
conditional statement.

drivers/misc/echo/echo.c:384:27: warning: equality comparison with
extraneous parentheses [-Wparentheses-equality]
        if ((ec->nonupdate_dwell == 0)) {
             ~~~~~~~~~~~~~~~~~~~~^~~~
drivers/misc/echo/echo.c:384:27: note: remove extraneous parentheses
around the comparison to silence this warning
        if ((ec->nonupdate_dwell == 0)) {
            ~                    ^   ~
drivers/misc/echo/echo.c:384:27: note: use '=' to turn this equality
comparison into an assignment
        if ((ec->nonupdate_dwell == 0)) {
                                 ^~
                                 =
1 warning generated.

Remove them and while we're at it, simplify the zero check as '!var' is
used more than 'var == 0'.

Reported-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/misc/echo/echo.c

index 8a5adc0d2e8873f1094c653d01bb12f610c41bab..3ebe5d75ad6a21932d4add792d1b55b765a64d99 100644 (file)
@@ -381,7 +381,7 @@ int16_t oslec_update(struct oslec_state *ec, int16_t tx, int16_t rx)
         */
        ec->factor = 0;
        ec->shift = 0;
-       if ((ec->nonupdate_dwell == 0)) {
+       if (!ec->nonupdate_dwell) {
                int p, logp, shift;
 
                /* Determine: