Re: [PATCH] iio: fix pointer cast warning

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

 




Am 14.07.2012 18:23, schrieb Peter Meerwald:
> fix compile warning reported by Fengguang Wu:
> 
> drivers/iio/light/adjd_s311.c: In function 'adjd_s311_trigger_handler':
> drivers/iio/light/adjd_s311.c:188:12: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
> drivers/iio/light/adjd_s311.c:188:4: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
> 
>    185              }
>    186
>    187              if (indio_dev->scan_timestamp)
>  > 188                      *(s64 *)((phys_addr_t)data->buffer + ALIGN(len, sizeof(s64)))
>    189                              = time_ns;
>    190              iio_push_to_buffer(buffer, (u8 *)data->buffer, time_ns);
>    191
> 
> Signed-off-by: Peter Meerwald <pmeerw@xxxxxxxxxx>
> Reported-by: Fengguang Wu <fengguang.wu@xxxxxxxxx>
> ---
>  drivers/iio/light/adjd_s311.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/light/adjd_s311.c b/drivers/iio/light/adjd_s311.c
> index e485142..1cbb449 100644
> --- a/drivers/iio/light/adjd_s311.c
> +++ b/drivers/iio/light/adjd_s311.c
> @@ -185,7 +185,7 @@ static irqreturn_t adjd_s311_trigger_handler(int irq, void *p)
>  	}
>  
>  	if (indio_dev->scan_timestamp)
> -		*(s64 *)((phys_addr_t)data->buffer + ALIGN(len, sizeof(s64)))
> +		*(s64 *)((u8 *)data->buffer + ALIGN(len, sizeof(s64)))
>  			= time_ns;
>  	iio_push_to_buffer(buffer, (u8 *)data->buffer, time_ns);
>  

a few lines below is an othern cast (u8 *)data->buffer, i do not see the rest of the code,
but perhaps adding a helper will help here to improve readability ?

just my 2 cents,
re,
 wh
--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux