Re: [PATCH] Staging: comedi: s626: Remove unnecessary cast on void pointer

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

 



On Wed, Jan 20, 2016 at 09:48:39PM -0200, Lucas Tanure wrote:
> The conversion from void pointer to any other pointer type is guaranteed by
> the C programming language.
> 
> Signed-off-by: Lucas Tanure <tanure@xxxxxxxxx>
> ---
>  drivers/staging/comedi/drivers/s626.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/comedi/drivers/s626.c b/drivers/staging/comedi/drivers/s626.c
> index 35f0f67..13259f0 100644
> --- a/drivers/staging/comedi/drivers/s626.c
> +++ b/drivers/staging/comedi/drivers/s626.c
> @@ -1476,7 +1476,7 @@ static bool s626_handle_eos_interrupt(struct comedi_device *dev)
>  	 * first uint16_t in the buffer because it contains junk data
>  	 * from the final ADC of the previous poll list scan.
>  	 */
> -	uint32_t *readaddr = (uint32_t *)devpriv->ana_buf.logical_base + 1;
> +	uint32_t *readaddr = devpriv->ana_buf.logical_base + 1;


No.  This is a bug.  We need the cast for the pointer math to work.
The original code increments by sizeof(uint32_t) the new code by
sizeof(char).

regards,
dan carpenter

_______________________________________________
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