Re: [PATCH] Staging: iio: Fix sparse endian warning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Ksenija, Greg,

On Wed, Mar 23, 2016 at 12:06 PM, Ksenija Stanojevic
<ksenija.stanojevic@xxxxxxxxx> wrote:
> Fix following sparse warning:
> warning: cast to restricted __be16

Please include line number information so we know which line sparse
complains about.

> Signed-off-by: Ksenija Stanojevic <ksenija.stanojevic@xxxxxxxxx>
> ---
>  drivers/staging/iio/adc/ad7606_spi.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/iio/adc/ad7606_spi.c b/drivers/staging/iio/adc/ad7606_spi.c
> index d873a51..825da07 100644
> --- a/drivers/staging/iio/adc/ad7606_spi.c
> +++ b/drivers/staging/iio/adc/ad7606_spi.c
> @@ -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]);

This patch is completely bogus:

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

Hence please revert commit 87787e5ef727ff15f7c552cc48823b469f2eb41b
Author: Ksenija Stanojevic <ksenija.stanojevic@xxxxxxxxx>
Date:   Wed Mar 23 12:06:34 2016 +0100

    Staging: iio: Fix sparse endian warning

BTW, what version of sparse are you using?
My (Ubuntu) version of sparse didn't complain about the original, neither does
the one I've just cloned from the master repository
(v0.5.0-44-g40791b94c56b1a6d)?

Hence I have no idea if fixing this by keeping the assignment of buf to data
is warned about....

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux