staging: comedi: amplc_dio200_pci: no need to test board pointer in dio200_pci_detach()
authorIan Abbott <abbotti@mev.co.uk>
Fri, 25 Jul 2014 17:07:09 +0000 (18:07 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 30 Jul 2014 23:47:44 +0000 (16:47 -0700)
`dio200_pci_detach()` doesn't need to check if the pointer to constant
board data (`thisboard`) and the pointer to private per-device data
(`devpriv`) are valid before calling `amplc_dio200_common_detach()`.  It
has no further need to check `thisboard` so remove the variable
altogether.  Move the test of `devpriv` to the first point it is needs
to be valid.

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

index 3cec0e020adb46f5c94b2015896e22320c13177e..1954c1bd23dbae12e551a77d37e53a443823dde0 100644 (file)
@@ -414,13 +414,10 @@ static int dio200_pci_auto_attach(struct comedi_device *dev,
 
 static void dio200_pci_detach(struct comedi_device *dev)
 {
-       const struct dio200_board *thisboard = comedi_board(dev);
        struct dio200_private *devpriv = dev->private;
 
-       if (!thisboard || !devpriv)
-               return;
        amplc_dio200_common_detach(dev);
-       if (devpriv->io.regtype == mmio_regtype)
+       if (devpriv && devpriv->io.regtype == mmio_regtype)
                iounmap(devpriv->io.u.membase);
        comedi_pci_disable(dev);
 }
This page took 0.025541 seconds and 5 git commands to generate.