linux/drivers/staging/comedi
Andrey Utkin d2fd4d395a staging: comedi: ni_atmio16d.c: remove pointless condition
The issue was discovered with static analysis and has two instances in
this file. The code looks like this
if (x < 65536000) {
	...
} else if (x < 655360000) {
	...
} else if (x <= 0xffffffff /* 6553600000 */) {
	...
} else if (x <= 0xffffffff /* 65536000000 */) {
	...
}

The meaning of this block is to select appropriate clock frequency for
interval timer basing on "x", which is amount of time.

Notes:
1. That last condition matches previous one - that's the issue.
2. Decimal numbers in comments don't match hex numbers in expressions.
But in first case the numbers have same order, while in the second case
the hex number is the same, and the decimal one is 10 times bigger.
3. Actually type of "x" is "unsigned int", so its exact upper limit is
not obviously known.
4. There's no "else" block.

So it makes sense to make an "else" block from last "else if" case. The
code inside the block seems correct for such usage.

[ Actually, get rid of the final "else if" case and change the
next-to-last "else if" case to an "else" as the upper limit of "x" _is_
known to be 0xffffffff (UINT_MAX), which is less than 6553600000 -- Ian ]

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=79871
Reported-by: David Binderman <dcb314@hotmail.com>
Signed-off-by: Andrey Utkin <andrey.krieger.utkin@gmail.com>
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-11 17:40:06 -07:00
..
drivers staging: comedi: ni_atmio16d.c: remove pointless condition 2014-07-11 17:40:06 -07:00
kcomedilib Staging: comedi: kcomedilib: replace deprecated simple_strtoul() with kstrtouint() 2014-02-15 12:42:41 -08:00
comedi_buf.c staging: comedi: pass subdevice to comedi_buf_write_n_available() 2014-05-23 21:25:50 +09:00
comedi_compat32.c file->f_op is never NULL... 2013-10-24 23:34:54 -04:00
comedi_compat32.h
comedi_fops.c Staging: comedi: check the return value of kobject_set_name 2014-07-09 12:19:36 -07:00
comedi_internal.h staging: comedi: pass subdevice to comedi_buf_is_mmapped() 2014-05-23 21:25:49 +09:00
comedi_pci.c
comedi_pcmcia.c
comedi_usb.c
comedi.h staging: comedi: ke_counter: expose clock source options to user space 2014-06-26 20:00:43 -04:00
comedidev.h staging: comedi: introduce comedi_buf_n_bytes_ready() 2014-06-26 20:00:44 -04:00
comedilib.h staging: comedi: comedi_bond: handle base channel for insn_bits 2013-08-26 06:41:56 -07:00
drivers.c staging: comedi: remove subdevice member of struct comedi_async 2014-05-23 21:25:51 +09:00
Kconfig Merge 3.16-rc2 into staging-next 2014-06-22 12:33:51 -04:00
Makefile staging: comedi: remove comedi_debug module parameter 2013-11-25 11:50:53 -08:00
proc.c Staging: comedi: proc: title block update 2014-03-19 04:41:04 +00:00
range.c Staging: comedi: range: remove unnecessary sanity check 2014-03-08 18:59:48 -08:00
TODO staging: comedi: TODO: remove item "reserve major number" 2014-05-28 14:18:11 -07:00