Skip to content

Commit

Permalink
staging: iio: fix ad7606_spi regression
Browse files Browse the repository at this point in the history
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: Ksenija Stanojevic <ksenija.stanojevic@gmail.com>
Fixes: 87787e5 ("Staging: iio: Fix sparse endian warning")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
  • Loading branch information
Arnd Bergmann authored and Jonathan Cameron committed Jun 11, 2016
1 parent 6e85dbe commit 7e98255
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/staging/iio/adc/ad7606_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 7e98255

Please sign in to comment.