staging: iio: cdc: simplify return flow
authorIoana Ciornei <ciorneiioana@gmail.com>
Wed, 14 Oct 2015 19:34:27 +0000 (22:34 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 17 Oct 2015 05:46:48 +0000 (22:46 -0700)
Simplify return flow ad7150_write_event_params in order to reduce code length.
Since i2c_smbus_write_word_data only returns a negative value or 0 the change is safe.

This patch fixes the following coccicheck warning:

drivers/staging/iio/cdc/ad7150.c:182:2-5: WARNING: end returns can be simpified if negative or 0 value

Signed-off-by: Ioana Ciornei <ciorneiioana@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/iio/cdc/ad7150.c

index ff833949591c7468d367cb4750058268fc77db4e..636a7ee4a5082b120f12a59a33b360319567c18b 100644 (file)
@@ -179,12 +179,9 @@ static int ad7150_write_event_params(struct iio_dev *indio_dev,
                /* Note completely different from the adaptive versions */
        case IIO_EV_TYPE_THRESH:
                value = chip->threshold[rising][chan];
-               ret = i2c_smbus_write_word_data(chip->client,
+               return i2c_smbus_write_word_data(chip->client,
                                                ad7150_addresses[chan][3],
                                                swab16(value));
-               if (ret < 0)
-                       return ret;
-               return 0;
        case IIO_EV_TYPE_MAG_ADAPTIVE:
                sens = chip->mag_sensitivity[rising][chan];
                timeout = chip->mag_timeout[rising][chan];