Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1363337 > unrolled thread

[PATCH] Staging: iio: Fix sparse endian warning

Started byKsenija Stanojevic <ksenija.stanojevic@gmail.com>
First post2016-03-23 12:10 +0100
Last post2016-03-28 16:40 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] Staging: iio: Fix sparse endian warning Ksenija Stanojevic <ksenija.stanojevic@gmail.com> - 2016-03-23 12:10 +0100
    Re: [PATCH] Staging: iio: Fix sparse endian warning Jonathan Cameron <jic23@kernel.org> - 2016-03-28 16:40 +0200

#1363337 — [PATCH] Staging: iio: Fix sparse endian warning

FromKsenija Stanojevic <ksenija.stanojevic@gmail.com>
Date2016-03-23 12:10 +0100
Subject[PATCH] Staging: iio: Fix sparse endian warning
Message-ID<rfOPN-2sH-39@gated-at.bofh.it>
Fix following sparse warning:
warning: cast to restricted __be16

Signed-off-by: Ksenija Stanojevic <ksenija.stanojevic@gmail.com>
---
 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]);
 
 	return 0;
 }
-- 
1.9.1

[toc] | [next] | [standalone]


#1365523

FromJonathan Cameron <jic23@kernel.org>
Date2016-03-28 16:40 +0200
Message-ID<rhGuK-8nW-21@gated-at.bofh.it>
In reply to#1363337
On 23/03/16 11:06, Ksenija Stanojevic wrote:
> Fix following sparse warning:
> warning: cast to restricted __be16
> 
> Signed-off-by: Ksenija Stanojevic <ksenija.stanojevic@gmail.com>
Subject amended to include the driver name.  I do tend to let some through
without whilst being lazy, but it really should give a hint of the scope
of the patch.  I'll be more vigorous about this in future!

Applied to the togreg branch of iio.git, initially pushed out as staging
for the autobuilders to play with it.

Thanks,

Jonathan
> ---
>  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]);
>  
>  	return 0;
>  }
> 

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web