From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759230AbcAUJjB (ORCPT ); Thu, 21 Jan 2016 04:39:01 -0500 Received: from aserp1040.oracle.com ([141.146.126.69]:36617 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758988AbcAUJi6 (ORCPT ); Thu, 21 Jan 2016 04:38:58 -0500 Date: Thu, 21 Jan 2016 12:38:51 +0300 From: Dan Carpenter To: Lucas Tanure Cc: Greg Kroah-Hartman , Ian Abbott , devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] Staging: comedi: s626: Remove unnecessary cast on void pointer Message-ID: <20160121093851.GF6370@mwanda> References: <1453333719-5688-1-git-send-email-tanure@linux.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1453333719-5688-1-git-send-email-tanure@linux.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Source-IP: userv0022.oracle.com [156.151.31.74] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- > 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