Skip to content

Commit

Permalink
Merge tag 'v3.6-rc1-iio-fixes-2' of git://git.kernel.org/pub/scm/linu…
Browse files Browse the repository at this point in the history
…x/kernel/git/jic23/iio into staging-linus

IIO fixes for v3.6-rc1 set 2

A few simple fixes.

1)Fix up some possible divide by zero issues in various drivers.

2)Prevent a memory leak in an error path in lis3l02dq

3)Make sure the PTR_ERR call in at91_adc matches the
check for IS_ERR just above it rather than using a different
pointer.

Merges fine against v3.6rc4
  • Loading branch information
Greg Kroah-Hartman committed Sep 4, 2012
2 parents 61ed59e + f755bbb commit d947d63
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion drivers/iio/adc/at91_adc.c
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ static int __devinit at91_adc_probe(struct platform_device *pdev)
st->adc_clk = clk_get(&pdev->dev, "adc_op_clk");
if (IS_ERR(st->adc_clk)) {
dev_err(&pdev->dev, "Failed to get the ADC clock.\n");
ret = PTR_ERR(st->clk);
ret = PTR_ERR(st->adc_clk);
goto error_disable_clk;
}

Expand Down
4 changes: 3 additions & 1 deletion drivers/staging/iio/accel/lis3l02dq_ring.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,10 @@ static int lis3l02dq_get_buffer_element(struct iio_dev *indio_dev,
if (rx_array == NULL)
return -ENOMEM;
ret = lis3l02dq_read_all(indio_dev, rx_array);
if (ret < 0)
if (ret < 0) {
kfree(rx_array);
return ret;
}
for (i = 0; i < scan_count; i++)
data[i] = combine_8_to_16(rx_array[i*4+1],
rx_array[i*4+3]);
Expand Down
2 changes: 2 additions & 0 deletions drivers/staging/iio/adc/ad7192.c
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,8 @@ static ssize_t ad7192_write_frequency(struct device *dev,
ret = strict_strtoul(buf, 10, &lval);
if (ret)
return ret;
if (lval == 0)
return -EINVAL;

mutex_lock(&indio_dev->mlock);
if (iio_buffer_enabled(indio_dev)) {
Expand Down
2 changes: 2 additions & 0 deletions drivers/staging/iio/gyro/adis16260_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,8 @@ static ssize_t adis16260_write_frequency(struct device *dev,
ret = strict_strtol(buf, 10, &val);
if (ret)
return ret;
if (val == 0)
return -EINVAL;

mutex_lock(&indio_dev->mlock);
if (spi_get_device_id(st->us)) {
Expand Down
2 changes: 2 additions & 0 deletions drivers/staging/iio/imu/adis16400_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,8 @@ static ssize_t adis16400_write_frequency(struct device *dev,
ret = strict_strtol(buf, 10, &val);
if (ret)
return ret;
if (val == 0)
return -EINVAL;

mutex_lock(&indio_dev->mlock);

Expand Down
2 changes: 2 additions & 0 deletions drivers/staging/iio/meter/ade7753.c
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,8 @@ static ssize_t ade7753_write_frequency(struct device *dev,
ret = strict_strtol(buf, 10, &val);
if (ret)
return ret;
if (val == 0)
return -EINVAL;

mutex_lock(&indio_dev->mlock);

Expand Down
2 changes: 2 additions & 0 deletions drivers/staging/iio/meter/ade7754.c
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,8 @@ static ssize_t ade7754_write_frequency(struct device *dev,
ret = strict_strtol(buf, 10, &val);
if (ret)
return ret;
if (val == 0)
return -EINVAL;

mutex_lock(&indio_dev->mlock);

Expand Down
2 changes: 2 additions & 0 deletions drivers/staging/iio/meter/ade7759.c
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,8 @@ static ssize_t ade7759_write_frequency(struct device *dev,
ret = strict_strtol(buf, 10, &val);
if (ret)
return ret;
if (val == 0)
return -EINVAL;

mutex_lock(&indio_dev->mlock);

Expand Down

0 comments on commit d947d63

Please sign in to comment.