mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
staging: comedi: amplc_pc236: fix invalid register access during detach
commit aaeb61a97b
upstream.
`pc236_detach()` is called by the comedi core if it attempted to attach
a device and failed. `pc236_detach()` calls `pc236_intr_disable()` if
the comedi device private data pointer (`devpriv`) is non-null. This
test is insufficient as `pc236_intr_disable()` accesses hardware
registers and the attach routine may have failed before it has saved
their I/O base addresses.
Fix it by checking `dev->iobase` is non-zero before calling
`pc236_intr_disable()` as that means the I/O base addresses have been
saved and the hardware registers can be accessed. It also implies the
comedi device private data pointer is valid, so there is no need to
check it.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
775dc1a3fd
commit
a0419caba8
1 changed files with 1 additions and 1 deletions
|
@ -468,7 +468,7 @@ static int pc236_detach(struct comedi_device *dev)
|
|||
{
|
||||
printk(KERN_DEBUG "comedi%d: %s: detach\n", dev->minor,
|
||||
PC236_DRIVER_NAME);
|
||||
if (devpriv)
|
||||
if (dev->iobase)
|
||||
pc236_intr_disable(dev);
|
||||
|
||||
if (dev->irq)
|
||||
|
|
Loading…
Reference in a new issue