On 2013-12-06 16:57, H Hartley Sweeten wrote:
Do the request_irq() before setting up the subdevices. Only hook up
the command support of the irq was sucessfully requested.
Note that, because of the IRQF_SHARED flag, nidio_interrupt() _may_
be called before the device is ready and the subdevices are setup.
This condition is handled by the (!dev->attached) sanity check. The
'dev->read_subdev' pointer might not be valid at this point so there
is an extra check to get the pointer to the comedi_async buffer.
Signed-off-by: H Hartley Sweeten <hswee...@visionengravers.com>
Cc: Ian Abbott <abbo...@mev.co.uk>
Cc: Greg Kroah-Hartman <gre...@linuxfoundation.org>
---
v3: fix a possible dereference of 's' in nido_interrupt()
drivers/staging/comedi/drivers/ni_pcidio.c | 40 +++++++++++++++---------------
1 file changed, 20 insertions(+), 20 deletions(-)
diff --git a/drivers/staging/comedi/drivers/ni_pcidio.c
b/drivers/staging/comedi/drivers/ni_pcidio.c
index 30c46a3..8f1b64d 100644
--- a/drivers/staging/comedi/drivers/ni_pcidio.c
+++ b/drivers/staging/comedi/drivers/ni_pcidio.c
@@ -385,7 +385,7 @@ static irqreturn_t nidio_interrupt(int irq, void *d)
struct comedi_device *dev = d;
struct nidio96_private *devpriv = dev->private;
struct comedi_subdevice *s = dev->read_subdev;
- struct comedi_async *async = s->async;
+ struct comedi_async *async = s ? s->async : NULL;
struct mite_struct *mite = devpriv->mite;
It should work, but wouldn't it be better to leave `async` unassigned
until after the `dev->attached` check?
--
-=( Ian Abbott @ MEV Ltd. E-mail: <abbo...@mev.co.uk> )=-
-=( Tel: +44 (0)161 477 1898 FAX: +44 (0)161 718 3587 )=-
_______________________________________________
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel