Skip to content
Commit 95330473 authored by Sven Eckelmann's avatar Sven Eckelmann Committed by Linus Torvalds
Browse files

checkpatch: remove false unbalanced braces warning

Lines containing "} else {" should not be detected as unbalanced braces.
But the second check can be reduced to ".+else\s*{" and it therefore
never checked if the beginning of a line contains any other character
(like the relevant "}").  This check would also return true for "} else
{" and create warnings like

    CHECK: Unbalanced braces around else statement
    #391: FILE: ./net/batman-adv/tvlv.c:391:
    +   } else {

The check can be changed to check the whole line for the missing "}" to
avoid this false positive.

Fixes: 0d1532456c26 ("checkpatch: notice unbalanced else braces in a patch")
Link: http://lkml.kernel.org/r/20170220121644.12209-1-sven@narfation.org


Signed-off-by: default avatarSven Eckelmann <sven@narfation.org>
Acked-by: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent e4c5babd
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment