public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Checkpatch.pl false positive? "ERROR: return is not a function, parentheses are not required"
@ 2010-03-28 19:28 Olimpiu Pascariu
  2010-03-28 20:09 ` Alexey Dobriyan
  2010-09-02 13:44 ` Andy Whitcroft
  0 siblings, 2 replies; 5+ messages in thread
From: Olimpiu Pascariu @ 2010-03-28 19:28 UTC (permalink / raw)
  To: apw, akpm, dwalker, joe; +Cc: linux-kernel

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. 

Regards,
Olimpiu Pascariu





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-09-02 13:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox