Skip to content

Commit

Permalink
staging: comedi: ni_labpc: unlock spinlock on command error
Browse files Browse the repository at this point in the history
When starting the acquisition the labpc_ai_cmd function was
exiting without unlocking the spinlock. This results in a
sparse warning:

warning: context imbalance in 'labpc_ai_cmd' - different lock contexts for basic block

Add the missing spin_unlock_irqrestore calls.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Mori Hess <fmhess@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
H Hartley Sweeten authored and Greg Kroah-Hartman committed Jun 11, 2012
1 parent 72fd9fa commit 513e48f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/staging/comedi/drivers/ni_labpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1386,6 +1386,7 @@ static int labpc_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
break;
default:
comedi_error(dev, "bug with start_src");
spin_unlock_irqrestore(&dev->spinlock, flags);
return -1;
break;
}
Expand All @@ -1398,6 +1399,7 @@ static int labpc_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
break;
default:
comedi_error(dev, "bug with stop_src");
spin_unlock_irqrestore(&dev->spinlock, flags);
return -1;
}
devpriv->write_byte(devpriv->command2_bits, dev->iobase + COMMAND2_REG);
Expand Down

0 comments on commit 513e48f

Please sign in to comment.