Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'iio-fixes-for-6.12c' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/jic23/iio into char-misc-next

Jonathan writes:

IIO: 3rd set of fixes for the 6.12 cycle

Usual mixed bag of new issues from this cycle and ancient bugs
recently noticed.

core
- Fix wrong fwnode handle if __fwnode_iio_channel_get_by_name()
looks at parents of the provider node.
core,backend
- Fix a wrong pointer error check.
gts library
- Fix plausible corner case where the value returned was not set.
- Avoid near infinite loop if the size of the table is 0.
(neither are an issue for current drivers).
adi,ad4000
- Fix reading of unsigned channels that were returning garbage.
adi,ad7780
- Prevent a division by zero.
adi,ad7923
- Fix buffer overflows in arrays that were not resized when devices
with more channels were added to the driver.
adi,adxl380
- Check only for negative error codes rather than including the
positive channel read values in an error check.
invense,common
- Fix an issue where changing the sampling rate to another value and
back again whilst the FIFO was off would not update things correctly.
kionix,kx022a
- Fix failure to sign extend value read from device.

* tag 'iio-fixes-for-6.12c' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/jic23/iio:
iio: Fix fwnode_handle in __fwnode_iio_channel_get_by_name()
iio: accel: adxl380: fix raw sample read
iio: accel: kx022a: Fix raw read format
iio: gts: fix infinite loop for gain_to_scaletables()
iio: gts: Fix uninitialized symbol 'ret'
iio: adc: ad4000: fix reading unsigned data
ad7780: fix division by zero in ad7780_write_raw()
iio: adc: ad7923: Fix buffer overflow for tx_buf and ring_xfer
iio: backend: fix wrong pointer passed to IS_ERR()
iio: invensense: fix multiple odr switch when FIFO is off

+16 -16
+1 -1
drivers/iio/accel/adxl380.c
··· 1181 1181 1182 1182 ret = adxl380_read_chn(st, chan->address); 1183 1183 iio_device_release_direct_mode(indio_dev); 1184 - if (ret) 1184 + if (ret < 0) 1185 1185 return ret; 1186 1186 1187 1187 *val = sign_extend32(ret >> chan->scan_type.shift,
+1 -1
drivers/iio/accel/kionix-kx022a.c
··· 594 594 if (ret) 595 595 return ret; 596 596 597 - *val = le16_to_cpu(data->buffer[0]); 597 + *val = (s16)le16_to_cpu(data->buffer[0]); 598 598 599 599 return IIO_VAL_INT; 600 600 }
+2
drivers/iio/adc/ad4000.c
··· 344 344 345 345 if (chan->scan_type.sign == 's') 346 346 *val = sign_extend32(sample, chan->scan_type.realbits - 1); 347 + else 348 + *val = sample; 347 349 348 350 return IIO_VAL_INT; 349 351 }
+1 -1
drivers/iio/adc/ad7780.c
··· 152 152 153 153 switch (m) { 154 154 case IIO_CHAN_INFO_SCALE: 155 - if (val != 0) 155 + if (val != 0 || val2 == 0) 156 156 return -EINVAL; 157 157 158 158 vref = st->int_vref_mv * 1000000LL;
+2 -2
drivers/iio/adc/ad7923.c
··· 48 48 49 49 struct ad7923_state { 50 50 struct spi_device *spi; 51 - struct spi_transfer ring_xfer[5]; 51 + struct spi_transfer ring_xfer[9]; 52 52 struct spi_transfer scan_single_xfer[2]; 53 53 struct spi_message ring_msg; 54 54 struct spi_message scan_single_msg; ··· 64 64 * Length = 8 channels + 4 extra for 8 byte timestamp 65 65 */ 66 66 __be16 rx_buf[12] __aligned(IIO_DMA_MINALIGN); 67 - __be16 tx_buf[4]; 67 + __be16 tx_buf[8]; 68 68 }; 69 69 70 70 struct ad7923_chip_info {
+4
drivers/iio/common/inv_sensors/inv_sensors_timestamp.c
··· 70 70 if (mult != ts->mult) 71 71 ts->new_mult = mult; 72 72 73 + /* When FIFO is off, directly apply the new ODR */ 74 + if (!fifo) 75 + inv_sensors_timestamp_apply_odr(ts, 0, 0, 0); 76 + 73 77 return 0; 74 78 } 75 79 EXPORT_SYMBOL_NS_GPL(inv_sensors_timestamp_update_odr, IIO_INV_SENSORS_TIMESTAMP);
-2
drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c
··· 200 200 { 201 201 struct inv_icm42600_state *st = iio_device_get_drvdata(indio_dev); 202 202 struct inv_icm42600_sensor_state *accel_st = iio_priv(indio_dev); 203 - struct inv_sensors_timestamp *ts = &accel_st->ts; 204 203 struct inv_icm42600_sensor_conf conf = INV_ICM42600_SENSOR_CONF_INIT; 205 204 unsigned int fifo_en = 0; 206 205 unsigned int sleep_temp = 0; ··· 228 229 } 229 230 230 231 /* update data FIFO write */ 231 - inv_sensors_timestamp_apply_odr(ts, 0, 0, 0); 232 232 ret = inv_icm42600_buffer_set_fifo_en(st, fifo_en | st->fifo.en); 233 233 234 234 out_unlock:
-3
drivers/iio/imu/inv_icm42600/inv_icm42600_gyro.c
··· 99 99 const unsigned long *scan_mask) 100 100 { 101 101 struct inv_icm42600_state *st = iio_device_get_drvdata(indio_dev); 102 - struct inv_icm42600_sensor_state *gyro_st = iio_priv(indio_dev); 103 - struct inv_sensors_timestamp *ts = &gyro_st->ts; 104 102 struct inv_icm42600_sensor_conf conf = INV_ICM42600_SENSOR_CONF_INIT; 105 103 unsigned int fifo_en = 0; 106 104 unsigned int sleep_gyro = 0; ··· 126 128 } 127 129 128 130 /* update data FIFO write */ 129 - inv_sensors_timestamp_apply_odr(ts, 0, 0, 0); 130 131 ret = inv_icm42600_buffer_set_fifo_en(st, fifo_en | st->fifo.en); 131 132 132 133 out_unlock:
-1
drivers/iio/imu/inv_mpu6050/inv_mpu_trigger.c
··· 112 112 if (enable) { 113 113 /* reset timestamping */ 114 114 inv_sensors_timestamp_reset(&st->timestamp); 115 - inv_sensors_timestamp_apply_odr(&st->timestamp, 0, 0, 0); 116 115 /* reset FIFO */ 117 116 d = st->chip_config.user_ctrl | INV_MPU6050_BIT_FIFO_RST; 118 117 ret = regmap_write(st->map, st->reg->user_ctrl, d);
+2 -2
drivers/iio/industrialio-backend.c
··· 737 737 } 738 738 739 739 fwnode_back = fwnode_find_reference(fwnode, "io-backends", index); 740 - if (IS_ERR(fwnode)) 741 - return dev_err_cast_probe(dev, fwnode, 740 + if (IS_ERR(fwnode_back)) 741 + return dev_err_cast_probe(dev, fwnode_back, 742 742 "Cannot get Firmware reference\n"); 743 743 744 744 guard(mutex)(&iio_back_lock);
+2 -2
drivers/iio/industrialio-gts-helper.c
··· 167 167 168 168 static int gain_to_scaletables(struct iio_gts *gts, int **gains, int **scales) 169 169 { 170 - int ret, i, j, new_idx, time_idx; 170 + int i, j, new_idx, time_idx, ret = 0; 171 171 int *all_gains; 172 172 size_t gain_bytes; 173 173 ··· 205 205 memcpy(all_gains, gains[time_idx], gain_bytes); 206 206 new_idx = gts->num_hwgain; 207 207 208 - while (time_idx--) { 208 + while (time_idx-- > 0) { 209 209 for (j = 0; j < gts->num_hwgain; j++) { 210 210 int candidate = gains[time_idx][j]; 211 211 int chk;
+1 -1
drivers/iio/inkern.c
··· 270 270 return ERR_PTR(-ENODEV); 271 271 } 272 272 273 - chan = __fwnode_iio_channel_get_by_name(fwnode, name); 273 + chan = __fwnode_iio_channel_get_by_name(parent, name); 274 274 if (!IS_ERR(chan) || PTR_ERR(chan) != -ENODEV) { 275 275 fwnode_handle_put(parent); 276 276 return chan;