Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ab784e50 authored by Ian Abbott's avatar Ian Abbott Committed by Greg Kroah-Hartman
Browse files

staging: comedi: das16: deschedule timer routine on detach



The "das16" driver optionally uses a kernel timer and a DMA channel to
support asynchronous data acquisition, but currently never calls
`del_timer_sync()`.  There is some possibility the timer routine could
still be scheduled to run when the comedi "detach" handler is run to
clean up the device and cause a certain amount of havoc.  Avoid that by
calling `del_time_sync()` in the comedi "detach" handler
`das16_detach()` if the timer was initialized by the "attach" handler
`das16_attach()`.  Use the timer's `data` member to tell whether it was
initialized or not.

Signed-off-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 35438c00
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -1228,6 +1228,8 @@ static void das16_detach(struct comedi_device *dev)
	int i;

	if (devpriv) {
		if (devpriv->timer.data)
			del_timer_sync(&devpriv->timer);
		if (dev->iobase)
			das16_reset(dev);