public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] staging: comedi: fix sparse warning in ni_mio_common.c
  2015-06-20 16:47 [PATCH] staging: comedi: fix sparse warning in ni_mio_common.c Geliang Tang
@ 2015-06-20 12:44 ` Ian Abbott
  2015-06-20 14:48 ` Greg KH
  1 sibling, 0 replies; 3+ messages in thread
From: Ian Abbott @ 2015-06-20 12:44 UTC (permalink / raw)
  To: Geliang Tang, hsweeten, gregkh; +Cc: devel, linux-kernel

On 20/06/15 17:47, Geliang Tang wrote:
> This patch fixes the following sparse warning:
>
> drivers/staging/comedi/drivers/ni_mio_common.c:573:26: warning: shift
> too big (4294967295) for type int
>
> Signed-off-by: Geliang Tang <geliangtang@163.com>
> ---
>   drivers/staging/comedi/drivers/ni_mio_common.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c
> index 6cc304a..420f752 100644
> --- a/drivers/staging/comedi/drivers/ni_mio_common.c
> +++ b/drivers/staging/comedi/drivers/ni_mio_common.c
> @@ -570,7 +570,7 @@ static inline void ni_set_bitfield(struct comedi_device *dev, int reg,
>   static inline unsigned ni_stc_dma_channel_select_bitfield(unsigned channel)
>   {
>   	if (channel < 4)
> -		return 1 << channel;
> +		return 1 << (channel & 0x03);
>   	if (channel == 4)
>   		return 0x3;
>   	if (channel == 5)
>

Surely that's a false positive sparse warning?

-- 
-=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti@mev.co.uk> )=-
-=(                          Web: http://www.mev.co.uk/  )=-
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] staging: comedi: fix sparse warning in ni_mio_common.c
  2015-06-20 16:47 [PATCH] staging: comedi: fix sparse warning in ni_mio_common.c Geliang Tang
  2015-06-20 12:44 ` Ian Abbott
@ 2015-06-20 14:48 ` Greg KH
  1 sibling, 0 replies; 3+ messages in thread
From: Greg KH @ 2015-06-20 14:48 UTC (permalink / raw)
  To: Geliang Tang; +Cc: abbotti, hsweeten, devel, linux-kernel

On Sat, Jun 20, 2015 at 04:47:33PM +0000, Geliang Tang wrote:
> This patch fixes the following sparse warning:
> 
> drivers/staging/comedi/drivers/ni_mio_common.c:573:26: warning: shift
> too big (4294967295) for type int
> 
> Signed-off-by: Geliang Tang <geliangtang@163.com>
> ---
>  drivers/staging/comedi/drivers/ni_mio_common.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c
> index 6cc304a..420f752 100644
> --- a/drivers/staging/comedi/drivers/ni_mio_common.c
> +++ b/drivers/staging/comedi/drivers/ni_mio_common.c
> @@ -570,7 +570,7 @@ static inline void ni_set_bitfield(struct comedi_device *dev, int reg,
>  static inline unsigned ni_stc_dma_channel_select_bitfield(unsigned channel)
>  {
>  	if (channel < 4)
> -		return 1 << channel;
> +		return 1 << (channel & 0x03);

Look at the code, this change makes no sense.

Sometimes tools are wrong, use them as a hint, not as something that has
to be silenced.

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] staging: comedi: fix sparse warning in ni_mio_common.c
@ 2015-06-20 16:47 Geliang Tang
  2015-06-20 12:44 ` Ian Abbott
  2015-06-20 14:48 ` Greg KH
  0 siblings, 2 replies; 3+ messages in thread
From: Geliang Tang @ 2015-06-20 16:47 UTC (permalink / raw)
  To: abbotti, hsweeten, gregkh; +Cc: devel, linux-kernel, Geliang Tang

This patch fixes the following sparse warning:

drivers/staging/comedi/drivers/ni_mio_common.c:573:26: warning: shift
too big (4294967295) for type int

Signed-off-by: Geliang Tang <geliangtang@163.com>
---
 drivers/staging/comedi/drivers/ni_mio_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c
index 6cc304a..420f752 100644
--- a/drivers/staging/comedi/drivers/ni_mio_common.c
+++ b/drivers/staging/comedi/drivers/ni_mio_common.c
@@ -570,7 +570,7 @@ static inline void ni_set_bitfield(struct comedi_device *dev, int reg,
 static inline unsigned ni_stc_dma_channel_select_bitfield(unsigned channel)
 {
 	if (channel < 4)
-		return 1 << channel;
+		return 1 << (channel & 0x03);
 	if (channel == 4)
 		return 0x3;
 	if (channel == 5)
-- 
1.9.1


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-06-20 14:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-20 16:47 [PATCH] staging: comedi: fix sparse warning in ni_mio_common.c Geliang Tang
2015-06-20 12:44 ` Ian Abbott
2015-06-20 14:48 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox