staging: iio: ad7192: Fix - use the dedicated reset function avoiding dma from stack.

Depends on: 691c4b95d1 ("iio: ad_sigma_delta: Implement a dedicated reset function")

SPI host drivers can use DMA to transfer data, so the buffer should be properly allocated.
Keeping it on the stack could cause an undefined behavior.

The dedicated reset function solves this issue.

Signed-off-by: Stefan Popa <stefan.popa@analog.com>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
Stefan Popa 2017-09-14 16:50:28 +03:00 коммит произвёл Jonathan Cameron
Родитель 3d62c78a6e
Коммит f790923f14
1 изменённых файлов: 1 добавлений и 3 удалений

Просмотреть файл

@ -223,11 +223,9 @@ static int ad7192_setup(struct ad7192_state *st,
struct iio_dev *indio_dev = spi_get_drvdata(st->sd.spi); struct iio_dev *indio_dev = spi_get_drvdata(st->sd.spi);
unsigned long long scale_uv; unsigned long long scale_uv;
int i, ret, id; int i, ret, id;
u8 ones[6];
/* reset the serial interface */ /* reset the serial interface */
memset(&ones, 0xFF, 6); ret = ad_sd_reset(&st->sd, 48);
ret = spi_write(st->sd.spi, &ones, 6);
if (ret < 0) if (ret < 0)
goto out; goto out;
usleep_range(500, 1000); /* Wait for at least 500us */ usleep_range(500, 1000); /* Wait for at least 500us */