Checkpatch.pl false positive? "ERROR: return is not a function, parentheses are not required"

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Olimpiu Pascariu
Date: Sunday, March 28, 2010 - 12:28 pm

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




--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Checkpatch.pl false positive? "ERROR: return is not a func ..., Olimpiu Pascariu, (Sun Mar 28, 12:28 pm)