Commit 6a058f0b authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'staging-5.8-rc6' of...

Merge tag 'staging-5.8-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging into master

Pull IIO and staging driver fixes from Greg KH:
 "Here are some IIO and staging driver fixes for 5.8-rc6.

  The majority of fixes are for IIO drivers, resolving a number of small
  reported issues, and there are some counter fixes in here too that
  were tied to the IIO fixes. There's only one staging driver fix here,
  a comedi fix found by code inspection.

  All of these have been in linux-next for a while with no reported
  issues"

* tag 'staging-5.8-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging:
  staging: comedi: verify array index is correct before using it
  iio: adc: ad7780: Fix a resource handling path in 'ad7780_probe()'
  iio:pressure:ms5611 Fix buffer element alignment
  iio:humidity:hts221 Fix alignment and data leak issues
  iio:humidity:hdc100x Fix alignment and data leak issues
  iio:magnetometer:ak8974: Fix alignment and data leak issues
  iio: adc: adi-axi-adc: Fix object reference counting
  iio: pressure: zpa2326: handle pm_runtime_get_sync failure
  counter: 104-quad-8: Add lock guards - filter clock prescaler
  counter: 104-quad-8: Add lock guards - differential encoder
  iio: core: add missing IIO_MOD_H2/ETHANOL string identifiers
  iio: magnetometer: ak8974: Fix runtime PM imbalance on error
  iio: mma8452: Add missed iio_device_unregister() call in mma8452_probe()
  iio:health:afe4404 Fix timestamp alignment and prevent data leak.
  iio:health:afe4403 Fix timestamp alignment and prevent data leak.
parents 7531ee31 ef75e14a
Loading
Loading
Loading
Loading
+19 −3
Original line number Diff line number Diff line
@@ -1274,18 +1274,26 @@ static ssize_t quad8_signal_cable_fault_read(struct counter_device *counter,
					     struct counter_signal *signal,
					     void *private, char *buf)
{
	const struct quad8_iio *const priv = counter->priv;
	struct quad8_iio *const priv = counter->priv;
	const size_t channel_id = signal->id / 2;
	const bool disabled = !(priv->cable_fault_enable & BIT(channel_id));
	bool disabled;
	unsigned int status;
	unsigned int fault;

	if (disabled)
	mutex_lock(&priv->lock);

	disabled = !(priv->cable_fault_enable & BIT(channel_id));

	if (disabled) {
		mutex_unlock(&priv->lock);
		return -EINVAL;
	}

	/* Logic 0 = cable fault */
	status = inb(priv->base + QUAD8_DIFF_ENCODER_CABLE_STATUS);

	mutex_unlock(&priv->lock);

	/* Mask respective channel and invert logic */
	fault = !(status & BIT(channel_id));

@@ -1317,6 +1325,8 @@ static ssize_t quad8_signal_cable_fault_enable_write(
	if (ret)
		return ret;

	mutex_lock(&priv->lock);

	if (enable)
		priv->cable_fault_enable |= BIT(channel_id);
	else
@@ -1327,6 +1337,8 @@ static ssize_t quad8_signal_cable_fault_enable_write(

	outb(cable_fault_enable, priv->base + QUAD8_DIFF_ENCODER_CABLE_STATUS);

	mutex_unlock(&priv->lock);

	return len;
}

@@ -1353,6 +1365,8 @@ static ssize_t quad8_signal_fck_prescaler_write(struct counter_device *counter,
	if (ret)
		return ret;

	mutex_lock(&priv->lock);

	priv->fck_prescaler[channel_id] = prescaler;

	/* Reset Byte Pointer */
@@ -1363,6 +1377,8 @@ static ssize_t quad8_signal_fck_prescaler_write(struct counter_device *counter,
	outb(QUAD8_CTR_RLD | QUAD8_RLD_RESET_BP | QUAD8_RLD_PRESET_PSC,
	     base_offset + 1);

	mutex_unlock(&priv->lock);

	return len;
}

+4 −1
Original line number Diff line number Diff line
@@ -1685,10 +1685,13 @@ static int mma8452_probe(struct i2c_client *client,

	ret = mma8452_set_freefall_mode(data, false);
	if (ret < 0)
		goto buffer_cleanup;
		goto unregister_device;

	return 0;

unregister_device:
	iio_device_unregister(indio_dev);

buffer_cleanup:
	iio_triggered_buffer_cleanup(indio_dev);

+1 −1
Original line number Diff line number Diff line
@@ -329,7 +329,7 @@ static int ad7780_probe(struct spi_device *spi)

	ret = ad7780_init_gpios(&spi->dev, st);
	if (ret)
		goto error_cleanup_buffer_and_trigger;
		return ret;

	st->reg = devm_regulator_get(&spi->dev, "avdd");
	if (IS_ERR(st->reg))
+2 −2
Original line number Diff line number Diff line
@@ -332,12 +332,12 @@ static struct adi_axi_adc_client *adi_axi_adc_attach_client(struct device *dev)
		if (cl->dev->of_node != cln)
			continue;

		if (!try_module_get(dev->driver->owner)) {
		if (!try_module_get(cl->dev->driver->owner)) {
			mutex_unlock(&registered_clients_lock);
			return ERR_PTR(-ENODEV);
		}

		get_device(dev);
		get_device(cl->dev);
		cl->info = info;
		mutex_unlock(&registered_clients_lock);
		return cl;
+6 −3
Original line number Diff line number Diff line
@@ -65,6 +65,7 @@ static const struct reg_field afe4403_reg_fields[] = {
 * @regulator: Pointer to the regulator for the IC
 * @trig: IIO trigger for this device
 * @irq: ADC_RDY line interrupt number
 * @buffer: Used to construct data layout to push into IIO buffer.
 */
struct afe4403_data {
	struct device *dev;
@@ -74,6 +75,8 @@ struct afe4403_data {
	struct regulator *regulator;
	struct iio_trigger *trig;
	int irq;
	/* Ensure suitable alignment for timestamp */
	s32 buffer[8] __aligned(8);
};

enum afe4403_chan_id {
@@ -309,7 +312,6 @@ static irqreturn_t afe4403_trigger_handler(int irq, void *private)
	struct iio_dev *indio_dev = pf->indio_dev;
	struct afe4403_data *afe = iio_priv(indio_dev);
	int ret, bit, i = 0;
	s32 buffer[8];
	u8 tx[4] = {AFE440X_CONTROL0, 0x0, 0x0, AFE440X_CONTROL0_READ};
	u8 rx[3];

@@ -326,7 +328,7 @@ static irqreturn_t afe4403_trigger_handler(int irq, void *private)
		if (ret)
			goto err;

		buffer[i++] = get_unaligned_be24(&rx[0]);
		afe->buffer[i++] = get_unaligned_be24(&rx[0]);
	}

	/* Disable reading from the device */
@@ -335,7 +337,8 @@ static irqreturn_t afe4403_trigger_handler(int irq, void *private)
	if (ret)
		goto err;

	iio_push_to_buffers_with_timestamp(indio_dev, buffer, pf->timestamp);
	iio_push_to_buffers_with_timestamp(indio_dev, afe->buffer,
					   pf->timestamp);
err:
	iio_trigger_notify_done(indio_dev->trig);

Loading