All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Lucas Tanure <tanure@linux.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Ian Abbott <abbotti@mev.co.uk>,
	devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Staging: comedi: s626: Remove unnecessary cast on void pointer
Date: Thu, 21 Jan 2016 12:38:51 +0300	[thread overview]
Message-ID: <20160121093851.GF6370@mwanda> (raw)
In-Reply-To: <1453333719-5688-1-git-send-email-tanure@linux.com>

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@linux.com>
> ---
>  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

      reply	other threads:[~2016-01-21  9:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-20 23:48 [PATCH] Staging: comedi: s626: Remove unnecessary cast on void pointer Lucas Tanure
2016-01-21  9:38 ` Dan Carpenter [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160121093851.GF6370@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=abbotti@mev.co.uk \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tanure@linux.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.