Commit c9b0f2b6 authored by Chris Cesare's avatar Chris Cesare Committed by Greg Kroah-Hartman

staging: comedi: serial2002: Fix unnecessary cast styling issue

checkpatch.pl warns that a cast of 1 to (long long) is unnecessary.
Remove the cast and also add code to check and make sure that
maxdata_list[chan] is not shifted too far, as suggested by Ian
Abbott.

Signed-off-by Chris Cesare <chris.cesare@gmail.com>
Reviewed-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 2e3d417c
...@@ -379,7 +379,10 @@ static int serial2002_setup_subdevice(struct comedi_subdevice *s, ...@@ -379,7 +379,10 @@ static int serial2002_setup_subdevice(struct comedi_subdevice *s,
range_table_list[chan] = range_table_list[chan] =
(const struct comedi_lrange *)&range[j]; (const struct comedi_lrange *)&range[j];
} }
maxdata_list[chan] = ((long long)1 << cfg[j].bits) - 1; if (cfg[j].bits < 32)
maxdata_list[chan] = (1u << cfg[j].bits) - 1;
else
maxdata_list[chan] = 0xffffffff;
chan++; chan++;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment