ni_labpc: Release spin-lock in labpc_ai_cmd returns an error.
authorIan Abbott <abbotti@mev.co.uk>
Wed, 6 Jun 2012 09:48:09 +0000 (10:48 +0100)
committerIan Abbott <abbotti@mev.co.uk>
Wed, 6 Jun 2012 09:48:09 +0000 (10:48 +0100)
There are a couple of places in labpc_ai_cmd() that return without
releasing the spin-lock.  These places should not be reachable, but
release the spin-lock anyway.

Spotted by H Hartley Sweeten in the "staging" sources.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
comedi/drivers/ni_labpc.c

index 94764f23893a206ee1547f9c080add30042230de..7fd67b9c87b44a5ecaf7a701fc3aac09a84315c0 100644 (file)
@@ -1289,6 +1289,7 @@ static int labpc_ai_cmd(comedi_device * dev, comedi_subdevice * s)
                break;
        default:
                comedi_error(dev, "bug with start_src");
                break;
        default:
                comedi_error(dev, "bug with start_src");
+               comedi_spin_unlock_irqrestore(&dev->spinlock, flags);
                return -1;
                break;
        }
                return -1;
                break;
        }
@@ -1301,6 +1302,7 @@ static int labpc_ai_cmd(comedi_device * dev, comedi_subdevice * s)
                break;
        default:
                comedi_error(dev, "bug with stop_src");
                break;
        default:
                comedi_error(dev, "bug with stop_src");
+               comedi_spin_unlock_irqrestore(&dev->spinlock, flags);
                return -1;
        }
        devpriv->write_byte(devpriv->command2_bits, dev->iobase + COMMAND2_REG);
                return -1;
        }
        devpriv->write_byte(devpriv->command2_bits, dev->iobase + COMMAND2_REG);