Skip to content

Commit 6e5c4f1

Browse files
committed
Merge tag 'staging-4.7-rc6' of git://git.kernel.org/pub/scm/linux/kernel/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
2 parents 756c0ae + d839722 commit 6e5c4f1

File tree

6 files changed

+15
-11
lines changed

6 files changed

+15
-11
lines changed

drivers/iio/accel/kxsd9.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ static int kxsd9_write_scale(struct iio_dev *indio_dev, int micro)
8181

8282
mutex_lock(&st->buf_lock);
8383
ret = spi_w8r8(st->us, KXSD9_READ(KXSD9_REG_CTRL_C));
84-
if (ret)
84+
if (ret < 0)
8585
goto error_ret;
8686
st->tx[0] = KXSD9_WRITE(KXSD9_REG_CTRL_C);
8787
st->tx[1] = (ret & ~KXSD9_FS_MASK) | i;
@@ -163,7 +163,7 @@ static int kxsd9_read_raw(struct iio_dev *indio_dev,
163163
break;
164164
case IIO_CHAN_INFO_SCALE:
165165
ret = spi_w8r8(st->us, KXSD9_READ(KXSD9_REG_CTRL_C));
166-
if (ret)
166+
if (ret < 0)
167167
goto error_ret;
168168
*val2 = kxsd9_micro_scales[ret & KXSD9_FS_MASK];
169169
ret = IIO_VAL_INT_PLUS_MICRO;

drivers/iio/adc/ad7266.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -396,8 +396,8 @@ static int ad7266_probe(struct spi_device *spi)
396396

397397
st = iio_priv(indio_dev);
398398

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

409409
st->vref_mv = ret / 1000;
410410
} else {
411+
/* Any other error indicates that the regulator does exist */
412+
if (PTR_ERR(st->reg) != -ENODEV)
413+
return PTR_ERR(st->reg);
411414
/* Use internal reference */
412415
st->vref_mv = 2500;
413416
}

drivers/iio/imu/inv_mpu6050/inv_mpu_acpi.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ static int asus_acpi_get_sensor_info(struct acpi_device *adev,
5656
int i;
5757
acpi_status status;
5858
union acpi_object *cpm;
59+
int ret;
5960

6061
status = acpi_evaluate_object(adev->handle, "CNF0", NULL, &buffer);
6162
if (ACPI_FAILURE(status))
@@ -82,10 +83,10 @@ static int asus_acpi_get_sensor_info(struct acpi_device *adev,
8283
}
8384
}
8485
}
85-
86+
ret = cpm->package.count;
8687
kfree(buffer.pointer);
8788

88-
return cpm->package.count;
89+
return ret;
8990
}
9091

9192
static int acpi_i2c_check_resource(struct acpi_resource *ares, void *data)

drivers/staging/iio/accel/sca3000_core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,7 @@ static ssize_t sca3000_read_frequency(struct device *dev,
594594
goto error_ret_mut;
595595
ret = sca3000_read_ctrl_reg(st, SCA3000_REG_CTRL_SEL_OUT_CTRL);
596596
mutex_unlock(&st->lock);
597-
if (ret)
597+
if (ret < 0)
598598
goto error_ret;
599599
val = ret;
600600
if (base_freq > 0)

drivers/staging/iio/adc/ad7606_spi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ static int ad7606_spi_read_block(struct device *dev,
2121
{
2222
struct spi_device *spi = to_spi_device(dev);
2323
int i, ret;
24-
unsigned short *data;
24+
unsigned short *data = buf;
2525
__be16 *bdata = buf;
2626

2727
ret = spi_read(spi, buf, count * 2);

drivers/staging/iio/impedance-analyzer/ad5933.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -444,10 +444,10 @@ static ssize_t ad5933_store(struct device *dev,
444444
st->settling_cycles = val;
445445

446446
/* 2x, 4x handling, see datasheet */
447-
if (val > 511)
448-
val = (val >> 1) | (1 << 9);
449-
else if (val > 1022)
447+
if (val > 1022)
450448
val = (val >> 2) | (3 << 9);
449+
else if (val > 511)
450+
val = (val >> 1) | (1 << 9);
451451

452452
dat = cpu_to_be16(val);
453453
ret = ad5933_i2c_write(st->client,

0 commit comments

Comments
 (0)