Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Stefan Popa and committed by
Jonathan Cameron
f790923f 3d62c78a

+1 -3
+1 -3
drivers/staging/iio/adc/ad7192.c
··· 223 223 struct iio_dev *indio_dev = spi_get_drvdata(st->sd.spi); 224 224 unsigned long long scale_uv; 225 225 int i, ret, id; 226 - u8 ones[6]; 227 226 228 227 /* reset the serial interface */ 229 - memset(&ones, 0xFF, 6); 230 - ret = spi_write(st->sd.spi, &ones, 6); 228 + ret = ad_sd_reset(&st->sd, 48); 231 229 if (ret < 0) 232 230 goto out; 233 231 usleep_range(500, 1000); /* Wait for at least 500us */