OSDN Git Service

staging: iio: meter: add check on return variables
authorAya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Tue, 3 Mar 2015 14:27:37 +0000 (16:27 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 6 Mar 2015 17:54:33 +0000 (09:54 -0800)
commite384b69a35ae96055774dbce9dea813043e21142
tree8c6a16b7892ba6a0880801471f3ad2a5fbdc25d1
parent82d28561b7e01eccaa36b06c987045f08a77b4f4
staging: iio: meter: add check on return variables

adds checks on variables that are used to return values. If
the value is less than zero, this indicates that an error
occurred and hence a message is printed through dev_err.
Checks are made on negative values only since spi_* functions
return negative error codes.

The functions were found using the following script but the
aforementioned modification was what was carried out in the end:
@@
identifier len,f;
@@

-int len;
 ... when != len
     when strict
-len =
+return
        f(...);
-return len;

Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Reviewed-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/iio/meter/ade7758_core.c