staging: comedi: ni_mio_common: fix interrupt handler for dev->read_subdev
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Thu, 21 Apr 2016 19:04:41 +0000 (12:04 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 29 Apr 2016 05:19:49 +0000 (22:19 -0700)
commitba5c0da886c5f75f3bf7cab2f1f23a9ba05e04a5
treeaeee66da37957f9ef8e12d74ce0f33d294925ac8
parent4b2d73898fdd75cc841a2a6fc978fdc7b5f5247a
staging: comedi: ni_mio_common: fix interrupt handler for dev->read_subdev

There may not be a dev->read_subdev, i.e. an analog input subdevice, that
supports async commands. If it doesn't exist the interrupt/dma will never
be enabled.  Fix ni_E_interrupt() so that the analog input subdevice is
only handled if it exists.

This also fixes minor NULL dereference issue in handle_a_interrupt().
If the dev->read_subdev is NULL the comedi_async pointer (s->async) will
not be allocated by the device postconfig so there is no way to get a
valid comedi_cmd (&s->async->cmd).

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/ni_mio_common.c