[OPW,kernel] staging: iio: adc: ad7816.c Fix sparce warning cast to restricted__be16.
diff mbox

Message ID 1414617250-22344-1-git-send-email-yeliztaneroglu@gmail.com
State New, archived
Headers show

Commit Message

Yeliz Taneroglu Oct. 29, 2014, 9:14 p.m. UTC
This patch fixes following sparse warnings:

drivers/staging/iio/adc/ad7816.c:93:17 warning: cast to restricted__be16

Signed-off-by: Yeliz Taneroglu <yeliztaneroglu@gmail.com>
---
 drivers/staging/iio/adc/ad7816.c | 2 --
 1 file changed, 2 deletions(-)

Comments

Daniel Baluta Oct. 29, 2014, 9:18 p.m. UTC | #1
On Wed, Oct 29, 2014 at 11:14 PM, Yeliz Taneroglu
<yeliztaneroglu@gmail.com> wrote:
> This patch fixes following sparse warnings:
>
> drivers/staging/iio/adc/ad7816.c:93:17 warning: cast to restricted__be16
>
> Signed-off-by: Yeliz Taneroglu <yeliztaneroglu@gmail.com>
> ---
>  drivers/staging/iio/adc/ad7816.c | 2 --
>  1 file changed, 2 deletions(-)
>
> diff --git a/drivers/staging/iio/adc/ad7816.c b/drivers/staging/iio/adc/ad7816.c
> index 734a7e4..2230cb6 100644
> --- a/drivers/staging/iio/adc/ad7816.c
> +++ b/drivers/staging/iio/adc/ad7816.c
> @@ -90,8 +90,6 @@ static int ad7816_spi_read(struct ad7816_chip_info *chip, u16 *data)
>                 return ret;
>         }
>
> -       *data = be16_to_cpu(*data);
> -
>         return ret;
>  }

Hi Yeliz,

Would you care to explain this?

Daniel.
Greg Kroah-Hartman Oct. 29, 2014, 10:29 p.m. UTC | #2
On Wed, Oct 29, 2014 at 11:14:10PM +0200, Yeliz Taneroglu wrote:
> This patch fixes following sparse warnings:
> 
> drivers/staging/iio/adc/ad7816.c:93:17 warning: cast to restricted__be16
> 
> Signed-off-by: Yeliz Taneroglu <yeliztaneroglu@gmail.com>
> ---
>  drivers/staging/iio/adc/ad7816.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/staging/iio/adc/ad7816.c b/drivers/staging/iio/adc/ad7816.c
> index 734a7e4..2230cb6 100644
> --- a/drivers/staging/iio/adc/ad7816.c
> +++ b/drivers/staging/iio/adc/ad7816.c
> @@ -90,8 +90,6 @@ static int ad7816_spi_read(struct ad7816_chip_info *chip, u16 *data)
>  		return ret;
>  	}
>  
> -	*data = be16_to_cpu(*data);

Deleting lines of code isn't an acceptable way to get rid of a sparse
warning, especially when you just changed the logic of the function.

Why did you do this?  What do you think the sparse warning means?

confused,

greg k-h

Patch
diff mbox

diff --git a/drivers/staging/iio/adc/ad7816.c b/drivers/staging/iio/adc/ad7816.c
index 734a7e4..2230cb6 100644
--- a/drivers/staging/iio/adc/ad7816.c
+++ b/drivers/staging/iio/adc/ad7816.c
@@ -90,8 +90,6 @@  static int ad7816_spi_read(struct ad7816_chip_info *chip, u16 *data)
 		return ret;
 	}
 
-	*data = be16_to_cpu(*data);
-
 	return ret;
 }