Skip to content

Commit

Permalink
Merge tag 'staging-4.7-rc6' of git://git.kernel.org/pub/scm/linux/ker…
Browse files Browse the repository at this point in the history
…nel/git/gregkh/staging

Pull staging and IIO fixes from Greg KH:
 "Here are a few small staging and iio driver fixes for 4.7-rc6.

  Nothing major here, just a number of small fixes, all have been in
  linux-next for a while, and the full details are in the shortlog"

* tag 'staging-4.7-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging:
  iio:ad7266: Fix probe deferral for vref
  iio:ad7266: Fix support for optional regulators
  iio:ad7266: Fix broken regulator error handling
  iio: accel: kxsd9: fix the usage of spi_w8r8()
  staging: iio: accel: fix error check
  staging: iio: ad5933: fix order of cycle conditions
  staging: iio: fix ad7606_spi regression
  iio: inv_mpu6050: Fix use-after-free in ACPI code
  • Loading branch information
torvalds committed Jul 1, 2016
2 parents 756c0ae + d839722 commit 6e5c4f1
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 11 deletions.
4 changes: 2 additions & 2 deletions drivers/iio/accel/kxsd9.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ static int kxsd9_write_scale(struct iio_dev *indio_dev, int micro)

mutex_lock(&st->buf_lock);
ret = spi_w8r8(st->us, KXSD9_READ(KXSD9_REG_CTRL_C));
if (ret)
if (ret < 0)
goto error_ret;
st->tx[0] = KXSD9_WRITE(KXSD9_REG_CTRL_C);
st->tx[1] = (ret & ~KXSD9_FS_MASK) | i;
Expand Down Expand Up @@ -163,7 +163,7 @@ static int kxsd9_read_raw(struct iio_dev *indio_dev,
break;
case IIO_CHAN_INFO_SCALE:
ret = spi_w8r8(st->us, KXSD9_READ(KXSD9_REG_CTRL_C));
if (ret)
if (ret < 0)
goto error_ret;
*val2 = kxsd9_micro_scales[ret & KXSD9_FS_MASK];
ret = IIO_VAL_INT_PLUS_MICRO;
Expand Down
7 changes: 5 additions & 2 deletions drivers/iio/adc/ad7266.c
Original file line number Diff line number Diff line change
Expand Up @@ -396,8 +396,8 @@ static int ad7266_probe(struct spi_device *spi)

st = iio_priv(indio_dev);

st->reg = devm_regulator_get(&spi->dev, "vref");
if (!IS_ERR_OR_NULL(st->reg)) {
st->reg = devm_regulator_get_optional(&spi->dev, "vref");
if (!IS_ERR(st->reg)) {
ret = regulator_enable(st->reg);
if (ret)
return ret;
Expand All @@ -408,6 +408,9 @@ static int ad7266_probe(struct spi_device *spi)

st->vref_mv = ret / 1000;
} else {
/* Any other error indicates that the regulator does exist */
if (PTR_ERR(st->reg) != -ENODEV)
return PTR_ERR(st->reg);
/* Use internal reference */
st->vref_mv = 2500;
}
Expand Down
5 changes: 3 additions & 2 deletions drivers/iio/imu/inv_mpu6050/inv_mpu_acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ static int asus_acpi_get_sensor_info(struct acpi_device *adev,
int i;
acpi_status status;
union acpi_object *cpm;
int ret;

status = acpi_evaluate_object(adev->handle, "CNF0", NULL, &buffer);
if (ACPI_FAILURE(status))
Expand All @@ -82,10 +83,10 @@ static int asus_acpi_get_sensor_info(struct acpi_device *adev,
}
}
}

ret = cpm->package.count;
kfree(buffer.pointer);

return cpm->package.count;
return ret;
}

static int acpi_i2c_check_resource(struct acpi_resource *ares, void *data)
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/iio/accel/sca3000_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ static ssize_t sca3000_read_frequency(struct device *dev,
goto error_ret_mut;
ret = sca3000_read_ctrl_reg(st, SCA3000_REG_CTRL_SEL_OUT_CTRL);
mutex_unlock(&st->lock);
if (ret)
if (ret < 0)
goto error_ret;
val = ret;
if (base_freq > 0)
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/iio/adc/ad7606_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ static int ad7606_spi_read_block(struct device *dev,
{
struct spi_device *spi = to_spi_device(dev);
int i, ret;
unsigned short *data;
unsigned short *data = buf;
__be16 *bdata = buf;

ret = spi_read(spi, buf, count * 2);
Expand Down
6 changes: 3 additions & 3 deletions drivers/staging/iio/impedance-analyzer/ad5933.c
Original file line number Diff line number Diff line change
Expand Up @@ -444,10 +444,10 @@ static ssize_t ad5933_store(struct device *dev,
st->settling_cycles = val;

/* 2x, 4x handling, see datasheet */
if (val > 511)
val = (val >> 1) | (1 << 9);
else if (val > 1022)
if (val > 1022)
val = (val >> 2) | (3 << 9);
else if (val > 511)
val = (val >> 1) | (1 << 9);

dat = cpu_to_be16(val);
ret = ad5933_i2c_write(st->client,
Expand Down

0 comments on commit 6e5c4f1

Please sign in to comment.