Skip to contentSkip to conversation

staging: iio: cdc: simplify return flow

PATCH New Ioana Ciornei 1 participant 1 message Oct 14, 2015

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: iio: cdc: simplify return flow

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

---
 drivers/staging/iio/cdc/ad7150.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/staging/iio/cdc/ad7150.c +1 -4
index ff83394..636a7ee 100644
@@ -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];
Signature · 1 line
2.1.4