Re: [PATCH] staging/comedi: fix sparse warning: shift too big

From: Ian Abbott
Date: Fri May 02 2014 - 12:51:25 EST


On 2014-05-02 15:57, Brilliantov Kirill Vladimirovich wrote:
Signed-off-by: Brilliantov Kirill Vladimirovich <brilliantov@xxxxxxxx>
---
drivers/staging/comedi/drivers/ni_stc.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/ni_stc.h b/drivers/staging/comedi/drivers/ni_stc.h
index f0630b78..197b568 100644
--- a/drivers/staging/comedi/drivers/ni_stc.h
+++ b/drivers/staging/comedi/drivers/ni_stc.h
@@ -717,7 +717,7 @@ enum AI_AO_Select_Bits {
static inline unsigned ni_stc_dma_channel_select_bitfield(unsigned channel)
{
if (channel < 4)
- return 1 << channel;
+ return 1 << (channel & 0x3);
if (channel == 4)
return 0x3;
if (channel == 5)


The warning seems a bit spurious!

--
-=( Ian Abbott @ MEV Ltd. E-mail: <abbotti@xxxxxxxxx> )=-
-=( Tel: +44 (0)161 477 1898 FAX: +44 (0)161 718 3587 )=-
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/