[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20100902134457.GS2406@shadowen.org>
Date: Thu, 2 Sep 2010 14:44:57 +0100
From: Andy Whitcroft <apw@...onical.com>
To: Olimpiu Pascariu <olimpiu.pascariu@...il.com>
Cc: akpm@...ux-foundation.org, dwalker@...o99.com, joe@...ches.com,
linux-kernel@...r.kernel.org
Subject: Re: Checkpatch.pl false positive? "ERROR: return is not a
function, parentheses are not required"
On Sun, Mar 28, 2010 at 10:28:13PM +0300, Olimpiu Pascariu wrote:
> Hi,
>
> I've used checkpatch.pl to verify drivers/staging/dt3155/dt3155_isr.c,
> in order to provide a patch which fixes the errors and warnings found by
> checkpatch.
> The script returns the following error:
> ERROR: return is not a function, parentheses are not required
> #155: FILE: staging/dt3155/dt3155_isr.c:155:
> + return (dt3155_fbuffer[m]->ready_head -
>
> The original code is:
>
> return (dt3155_fbuffer[m]->ready_head -
> dt3155_fbuffer[m]->ready_len +
> dt3155_fbuffer[m]->nbuffers)%
> (dt3155_fbuffer[m]->nbuffers);
>
> I've deleted the the first open parenthesis and the last close
> parenthesis, and now the code looks like this:
>
> return (dt3155_fbuffer[m]->ready_head -
> dt3155_fbuffer[m]->ready_len +
> dt3155_fbuffer[m]->nbuffers)%
> (dt3155_fbuffer[m]->nbuffers);
>
> IMHO the code is correct, though an auxiliary variable could be used to
> avoid this error returned by checkpatch.pl.
This code is indeed correct. This is a bug in checkpatch, I think I
have sorted out the bug in the version below (which should be mirrored
out shortly). If you could test the version below and let me know that
would be helpful:
http://www.kernel.org/pub/linux/kernel/people/apw/checkpatch/checkpatch.pl-testing
-apw
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists