linux-xiaomi-chiron/drivers/staging
Ian Abbott 9fea3a40f6 staging: comedi: ni_routes: allow partial routing information
This patch fixes a regression on setting up asynchronous commands to use
external trigger sources when board-specific routing information is
missing.

`ni_find_device_routes()` (called via `ni_assign_device_routes()`) finds
the table of register values for the device family and the set of valid
routes for the specific board.  If both are found,
`tables->route_values` is set to point to the table of register values
for the device family and `tables->valid_routes` is set to point to the
list of valid routes for the specific board.  If either is not found,
both `tables->route_values` and `tables->valid_routes` are left set at
their initial null values (initialized by `ni_assign_device_routes()`)
and the function returns `-ENODATA`.

Returning an error results in some routing functionality being disabled.
Unfortunately, leaving `table->route_values` set to `NULL` also breaks
the setting up of asynchronous commands that are configured to use
external trigger sources.  Calls to `ni_check_trigger_arg()` or
`ni_check_trigger_arg_roffs()` while checking the asynchronous command
set-up would result in a null pointer dereference if
`table->route_values` is `NULL`.  The null pointer dereference is fixed
in another patch, but it now results in failure to set up the
asynchronous command.  That is a regression from the behavior prior to
commit 347e244884 ("staging: comedi: tio: implement global tio/ctr
routing") and commit 56d0b826d3 ("staging: comedi: ni_mio_common:
implement new routing for TRIG_EXT").

Change `ni_find_device_routes()` to set `tables->route_values` and/or
`tables->valid_routes` to valid information even if the other one can
only be set to `NULL` due to missing information.  The function will
still return an error in that case.  This should result in
`tables->valid_routes` being valid for all currently supported device
families even if the board-specific routing information is missing.
That should be enough to fix the regression on setting up asynchronous
commands to use external triggers for boards with missing routing
information.

Fixes: 347e244884 ("staging: comedi: tio: implement global tio/ctr routing")
Fixes: 56d0b826d3 ("staging: comedi: ni_mio_common: implement new routing for TRIG_EXT").
Cc: <stable@vger.kernel.org> # 4.20+
Cc: Spencer E. Olson <olsonse@umich.edu>
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Link: https://lore.kernel.org/r/20200114182532.132058-3-abbotti@mev.co.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-15 13:30:09 +01:00
..
android
axis-fifo staging: axis-fifo: add unspecified HAS_IOMEM dependency 2019-12-17 09:22:11 +01:00
board
clocking-wizard
comedi staging: comedi: ni_routes: allow partial routing information 2020-01-15 13:30:09 +01:00
emxx_udc
exfat staging: exfat: fix multiple definition error of `rename_file' 2019-12-10 10:56:55 +01:00
fbtft fbtft: Fix the initialization from property algorithm 2019-12-10 15:55:55 +01:00
fieldbus
fsl-dpaa2
fwserial
gasket pci-v5.5-changes 2019-12-03 13:58:22 -08:00
gdm724x
goldfish
greybus
gs_fpgaboot
hp staging: hp100: Fix build error without ETHERNET 2019-12-10 10:56:54 +01:00
iio
isdn staging: gigaset: add endpoint-type sanity check 2019-12-10 11:08:07 +01:00
kpc2000
ks7010
media media: intel-ipu3: Align struct ipu3_uapi_awb_fr_config_s to 32 bytes 2020-01-03 15:02:59 +01:00
most
mt7621-dma
mt7621-dts
mt7621-pci
mt7621-pci-phy
mt7621-pinctrl
netlogic
nvec
octeon staging/octeon: Mark Ethernet driver as BROKEN 2019-12-10 10:03:01 +01:00
octeon-usb
olpc_dcon
pi433 compat_ioctl: remove most of fs/compat_ioctl.c 2019-12-01 13:46:15 -08:00
qlge treewide: Use sizeof_field() macro 2019-12-09 10:36:44 -08:00
ralink-gdma
rtl8188eu staging: rtl8188eu: Add device code for TP-Link TL-WN727N v5.21 2020-01-03 11:47:00 +01:00
rtl8192e
rtl8192u
rtl8712 staging: rtl8712: fix interface sanity check 2019-12-10 13:22:21 +01:00
rtl8723bs
rts5208
sm750fb
speakup
unisys
uwb
vc04_services staging: vchiq: call unregister_chrdev_region() when driver registration fails 2019-12-10 10:56:56 +01:00
vme
vt6655
vt6656 staging: vt6656: set usb_set_intfdata on driver fail. 2020-01-03 11:46:59 +01:00
wfx staging: wfx: fix wrong error message 2019-12-18 15:51:06 +01:00
wilc1000
wlan-ng staging/wlan-ng: add CRC32 dependency in Kconfig 2019-12-10 10:56:54 +01:00
wusbcore
Kconfig
Makefile