aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIan Abbott <abbotti@mev.co.uk>2012-10-03 16:25:17 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-10-31 09:51:42 -0700
commit5a30fddcc9593086c26cef6496f757e262059cf6 (patch)
tree450ca5fd386aa2fd841c0ff411a7c42ba8161d83
parent0ac1713daef94fa5a28947ce7149d45d4202da7d (diff)
downloadkernel_samsung_crespo-5a30fddcc9593086c26cef6496f757e262059cf6.zip
kernel_samsung_crespo-5a30fddcc9593086c26cef6496f757e262059cf6.tar.gz
kernel_samsung_crespo-5a30fddcc9593086c26cef6496f757e262059cf6.tar.bz2
staging: comedi: amplc_pc236: fix invalid register access during detach
commit aaeb61a97b7159ebe30b18a422d04eeabfa8790b 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>
-rw-r--r--drivers/staging/comedi/drivers/amplc_pc236.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/staging/comedi/drivers/amplc_pc236.c b/drivers/staging/comedi/drivers/amplc_pc236.c
index 48246cd..b4311bf 100644
--- a/drivers/staging/comedi/drivers/amplc_pc236.c
+++ b/drivers/staging/comedi/drivers/amplc_pc236.c
@@ -470,7 +470,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)