From: Ian Abbott Date: Wed, 6 Jun 2012 09:48:09 +0000 (+0100) Subject: ni_labpc: Release spin-lock in labpc_ai_cmd returns an error. X-Git-Url: http://git.tremily.us/?p=comedi.git;a=commitdiff_plain;h=734675b473eec85220d1f4d6c324a315cab6193b ni_labpc: Release spin-lock in labpc_ai_cmd returns an error. 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 --- diff --git a/comedi/drivers/ni_labpc.c b/comedi/drivers/ni_labpc.c index 94764f23..7fd67b9c 100644 --- a/comedi/drivers/ni_labpc.c +++ b/comedi/drivers/ni_labpc.c @@ -1289,6 +1289,7 @@ static int labpc_ai_cmd(comedi_device * dev, comedi_subdevice * s) break; default: comedi_error(dev, "bug with start_src"); + comedi_spin_unlock_irqrestore(&dev->spinlock, flags); 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"); + comedi_spin_unlock_irqrestore(&dev->spinlock, flags); return -1; } devpriv->write_byte(devpriv->command2_bits, dev->iobase + COMMAND2_REG);