On Wed, 2020-12-30 at 14:36 +0100, Jan Schlien wrote:
> Hi,
> 
> I found some odd behavior of checkpatch.pl, which I'm currently using
> for own projects outside the kernel, but I verified that kernel patches
> can be affected as well.

Hello Jan.

I've had this patch locally for awhile that I believe fixes this
and another issue ($stat blocks can start with a close brace).

I've been waiting for Andy to review it in case there's some other
parsing problem associated with it.
---
 scripts/checkpatch.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 00085308ed9d..012c8dc6cb1a 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1555,7 +1555,7 @@ sub ctx_statement_block {
 
                # Statement ends at the ';' or a close '}' at the
                # outermost level.
-               if ($level == 0 && $c eq ';') {
+               if ($level == 0 && ($c eq ';' || $c eq '}')) {
                        last;
                }
 

Reply via email to