From: Andy Whitcroft <apw@canonical.com>
To: Olimpiu Pascariu <olimpiu.pascariu@gmail.com>
Cc: akpm@linux-foundation.org, dwalker@fifo99.com, joe@perches.com,
linux-kernel@vger.kernel.org
Subject: Re: Checkpatch.pl false positive? "ERROR: return is not a function, parentheses are not required"
Date: Thu, 2 Sep 2010 14:44:57 +0100 [thread overview]
Message-ID: <20100902134457.GS2406@shadowen.org> (raw)
In-Reply-To: <1269804493.7079.14.camel@tuxtm-linux>
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
prev parent reply other threads:[~2010-09-02 13:45 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-28 19:28 Checkpatch.pl false positive? "ERROR: return is not a function, parentheses are not required" Olimpiu Pascariu
2010-03-28 20:09 ` Alexey Dobriyan
2010-03-28 19:59 ` Joe Perches
2010-03-28 20:56 ` Olimpiu Pascariu
2010-09-02 13:44 ` Andy Whitcroft [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100902134457.GS2406@shadowen.org \
--to=apw@canonical.com \
--cc=akpm@linux-foundation.org \
--cc=dwalker@fifo99.com \
--cc=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
--cc=olimpiu.pascariu@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox