linux/drivers/staging/comedi
Gustavo A. R. Silva a7ed5b3e7d staging: comedi: tio: fix multiple missing break in switch bugs
Currently, there are multiple missing break statements in two switch code
blocks. This makes the execution path to fall all the way down through
to the default cases, which makes the function ni_tio_set_gate_src() to
always return -EINVAL.

Fix this by adding the missing break statements.

Also, notice that due to the absence of the break statements,
the following pieces of code are unreachable:

1078    if (ret)
1079            return ret;
1080    /* 3.  reenable & set mode to starts things back up */
1081    ni_tio_set_gate_mode(counter, src);

1098    if (ret)
1099            return ret;
1100    /* 3.  reenable & set mode to starts things back up */
1101    ni_tio_set_gate2_mode(counter, src);

So, by adding the missing breaks, this patch also fixes the problem
above.

Addresses-Coverity-ID: 1474165 ("Missing break in switch")
Addresses-Coverity-ID: 1474162 ("Structurally dead code")
Fixes: 347e244884 ("staging: comedi: tio: implement global tio/ctr routing")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-10-14 13:31:53 +02:00
..
drivers staging: comedi: tio: fix multiple missing break in switch bugs 2018-10-14 13:31:53 +02:00
kcomedilib staging: comedi: Remove redundant license text 2017-11-28 13:20:46 +01:00
Kconfig staging: comedi: add interface to ni routing table information 2018-10-09 15:36:04 +02:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
TODO
comedi.h staging: comedi: add new device-global config interface 2018-10-09 15:32:38 +02:00
comedi_buf.c staging: comedi: Remove redundant license text 2017-11-28 13:20:46 +01:00
comedi_compat32.c Staging:Comedi:comedi_compat32.c: Lindent changes 2018-05-15 09:31:38 +02:00
comedi_compat32.h Staging: comedi: comedi_compat32.h: fixed missing or malformed SPDX-License-Identifier 2018-06-18 10:55:11 +02:00
comedi_fops.c staging: comedi: add new device-global config interface 2018-10-09 15:32:38 +02:00
comedi_internal.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
comedi_pci.c staging: comedi: Remove redundant license text 2017-11-28 13:20:46 +01:00
comedi_pci.h Staging: comedi: comedi_pci.h: fixed missing or malformed SPDX-License-Identifier 2018-06-18 10:55:11 +02:00
comedi_pcmcia.c staging: comedi: Remove redundant license text 2017-11-28 13:20:46 +01:00
comedi_pcmcia.h Staging: comedi: comedi_pcmcia.h: fixed missing or malformed SPDX-License-Identifier 2018-06-18 10:55:11 +02:00
comedi_usb.c staging: comedi: Remove redundant license text 2017-11-28 13:20:46 +01:00
comedi_usb.h staging: comedi: comedi_usb.h: SPDX License Identifier is added in the first line 2018-05-31 19:00:53 +02:00
comedidev.h staging: comedi: add new device-global config interface 2018-10-09 15:32:38 +02:00
comedilib.h Staging: comedi: comedilib.h: fixed missing or malformed SPDX-License-Identifier 2018-06-18 10:55:11 +02:00
drivers.c staging: comedi: add new device-global config interface 2018-10-09 15:32:38 +02:00
proc.c proc: introduce proc_create_single{,_data} 2018-05-16 07:23:35 +02:00
range.c staging: comedi: Remove redundant license text 2017-11-28 13:20:46 +01:00