[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1464616249-3523805-1-git-send-email-arnd@arndb.de>
Date: Mon, 30 May 2016 15:50:24 +0200
From: Arnd Bergmann <arnd@...db.de>
To: Lars-Peter Clausen <lars@...afoo.de>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Arnd Bergmann <arnd@...db.de>,
Geert Uytterhoeven <geert@...ux-m68k.org>,
Ksenija Stanojevic <ksenija.stanojevic@...il.com>,
Michael Hennerich <Michael.Hennerich@...log.com>,
Jonathan Cameron <jic23@...nel.org>,
Hartmut Knaack <knaack.h@....de>,
Peter Meerwald-Stadler <pmeerw@...erw.net>,
Ioana Ciornei <ciorneiioana@...il.com>,
Daniel Baluta <daniel.baluta@...el.com>,
linux-iio@...r.kernel.org, devel@...verdev.osuosl.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] staging: iio: fix ad7606_spi regression
As pointed out by Geert Uytterhoeven, the patch was incorrect
and breaks the driver, which was fortunately pointed out by
this gcc warning:
drivers/staging/iio/adc/ad7606_spi.c: In function ‘ad7606_spi_read_block’:
drivers/staging/iio/adc/ad7606_spi.c:34: warning: ‘data’ is used uninitialized in this function
The effect of the patch is that the data is copied into
a random memory location (from the uninitialized pointer)
instead of being byteswapped in place.
This adds the initialization for the 'data' variable back
to restore the original behavior.
Cc: Geert Uytterhoeven <geert@...ux-m68k.org>
Cc: Ksenija Stanojevic <ksenija.stanojevic@...il.com>
Fixes: 87787e5ef727 ("Staging: iio: Fix sparse endian warning")
Signed-off-by: Arnd Bergmann <arnd@...db.de>
---
drivers/staging/iio/adc/ad7606_spi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/iio/adc/ad7606_spi.c b/drivers/staging/iio/adc/ad7606_spi.c
index 825da0769936..9587fa86dc69 100644
--- a/drivers/staging/iio/adc/ad7606_spi.c
+++ b/drivers/staging/iio/adc/ad7606_spi.c
@@ -21,7 +21,7 @@ static int ad7606_spi_read_block(struct device *dev,
{
struct spi_device *spi = to_spi_device(dev);
int i, ret;
- unsigned short *data;
+ unsigned short *data = buf;
__be16 *bdata = buf;
ret = spi_read(spi, buf, count * 2);
--
2.7.0
Powered by blists - more mailing lists