[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <lsq.1514480744.379889300@decadent.org.uk>
Date: Thu, 28 Dec 2017 17:05:44 +0000
From: Ben Hutchings <ben@...adent.org.uk>
To: linux-kernel@...r.kernel.org, stable@...r.kernel.org
CC: akpm@...ux-foundation.org,
"Jonathan Cameron" <Jonathan.Cameron@...wei.com>,
"Stefan Popa" <stefan.popa@...log.com>,
"Lars-Peter Clausen" <lars@...afoo.de>,
"Michael Hennerich" <michael.hennerich@...log.com>
Subject: [PATCH 3.16 045/204] staging: iio: ad7192: Fix - use the
dedicated reset function avoiding dma from stack.
3.16.52-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Popa <stefan.popa@...log.com>
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@...log.com>
Acked-by: Lars-Peter Clausen <lars@...afoo.de>
Acked-by: Michael Hennerich <michael.hennerich@...log.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@...wei.com>
Signed-off-by: Ben Hutchings <ben@...adent.org.uk>
---
drivers/staging/iio/adc/ad7192.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
--- a/drivers/staging/iio/adc/ad7192.c
+++ b/drivers/staging/iio/adc/ad7192.c
@@ -206,11 +206,9 @@ static int ad7192_setup(struct ad7192_st
struct iio_dev *indio_dev = spi_get_drvdata(st->sd.spi);
unsigned long long scale_uv;
int i, ret, id;
- u8 ones[6];
/* reset the serial interface */
- memset(&ones, 0xFF, 6);
- ret = spi_write(st->sd.spi, &ones, 6);
+ ret = ad_sd_reset(&st->sd, 48);
if (ret < 0)
goto out;
msleep(1); /* Wait for at least 500us */
Powered by blists - more mailing lists