The function ad7150_write_event_config() defined in file drivers/staging/iio/cdc/ad7150.c directly returns 0 at line 277. As a result, it will return 0 even on failures. However, almost all of other write_event_config() functions (e.g. mma8452_write_event_config() in file drivers/accel/mma8452.c, stk3310_write_event_config() in file drivers/light/stk3310.c) returns negative values on errors. In fact, in function ad7150_write_event_config(), the error codes are assigned to variable ret on failures. Maybe "return 0;" is a typo, and the author intends to "return ret;"? Codes related to this bug are summarised as follows. ad7150_write_event_config @@ drivers/staging/iio/cdc/ad7150.c 212 static int ad7150_write_event_config(struct iio_dev *indio_dev, 213 const struct iio_chan_spec *chan, 214 enum iio_event_type type, 215 enum iio_event_direction dir, int state) 216 { 217 u8 thresh_type, cfg, adaptive; 218 int ret; ... 231 ret = i2c_smbus_read_byte_data(chip->client, AD7150_CFG); 232 if (ret < 0) 233 goto error_ret; ... 272 /* update control attributes */ 273 ret = ad7150_write_event_params(indio_dev, chan->channel, type, dir); 274 error_ret: 275 mutex_unlock(&chip->state_lock); 276 277 return 0; 278 } Thanks very much!
Created attachment 256429 [details] The patch fixes the bug
The patch has been merged into the latest version of the Linux kernel. So I will close the bug.