]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Staging: iio: Fix sparse endian warning
authorKsenija Stanojevic <ksenija.stanojevic@gmail.com>
Wed, 23 Mar 2016 11:06:34 +0000 (12:06 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 28 Mar 2016 14:30:36 +0000 (07:30 -0700)
Fix following sparse warning:
warning: cast to restricted __be16

Signed-off-by: Ksenija Stanojevic <ksenija.stanojevic@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/iio/adc/ad7606_spi.c

index d873a5164595159e2afbab5d7bf04b041f4681f9..825da0769936ace09907977be92392dda5447407 100644 (file)
@@ -21,7 +21,8 @@ static int ad7606_spi_read_block(struct device *dev,
 {
        struct spi_device *spi = to_spi_device(dev);
        int i, ret;
-       unsigned short *data = buf;
+       unsigned short *data;
+       __be16 *bdata = buf;
 
        ret = spi_read(spi, buf, count * 2);
        if (ret < 0) {
@@ -30,7 +31,7 @@ static int ad7606_spi_read_block(struct device *dev,
        }
 
        for (i = 0; i < count; i++)
-               data[i] = be16_to_cpu(data[i]);
+               data[i] = be16_to_cpu(bdata[i]);
 
        return 0;
 }