Skip to content

Commit b86df98

Browse files
stefpopagregkh
authored andcommitted
staging: iio: ad7192: Fix - use the dedicated reset function avoiding dma from stack.
commit f790923f146140a261ad211e5baf75d169f16fb2 upstream. 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> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 4b9c62a commit b86df98

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

drivers/staging/iio/adc/ad7192.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,11 +205,9 @@ static int ad7192_setup(struct ad7192_state *st,
205205
struct iio_dev *indio_dev = spi_get_drvdata(st->sd.spi);
206206
unsigned long long scale_uv;
207207
int i, ret, id;
208-
u8 ones[6];
209208

210209
/* reset the serial interface */
211-
memset(&ones, 0xFF, 6);
212-
ret = spi_write(st->sd.spi, &ones, 6);
210+
ret = ad_sd_reset(&st->sd, 48);
213211
if (ret < 0)
214212
goto out;
215213
usleep_range(500, 1000); /* Wait for at least 500us */

0 commit comments

Comments
 (0)