diff options
author | Ian Abbott <abbotti@mev.co.uk> | 2013-08-23 13:45:06 (GMT) |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-08-26 13:41:56 (GMT) |
commit | 7b8cbe92be6dc2665e3247f4b136199055972b5a (patch) | |
tree | 26dda3a752c2a0be1a19d5323bdaff2b62d02a77 | |
parent | c2af5b9681a9d1beaf37310ee3d6a5c4860750d5 (diff) | |
download | linux-fsl-qoriq-7b8cbe92be6dc2665e3247f4b136199055972b5a.tar.xz |
staging: comedi: comedi_bond: just check devprivs->devs once on detach
The `while` loop in `bonding_detach()` doesn't need to check
`devpriv->devs` each time round the loop. Move the test outside the
loop. The enclosing `if (devpriv)` can be changed to `if (devpriv &&
devpriv->devs)` as everything in this `if` statement is associated with
`devpriv->devs` anyway.
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/comedi_bond.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/staging/comedi/drivers/comedi_bond.c b/drivers/staging/comedi/drivers/comedi_bond.c index a2cc285..2ea605f 100644 --- a/drivers/staging/comedi/drivers/comedi_bond.c +++ b/drivers/staging/comedi/drivers/comedi_bond.c @@ -339,11 +339,11 @@ static void bonding_detach(struct comedi_device *dev) { struct comedi_bond_private *devpriv = dev->private; - if (devpriv) { + if (devpriv && devpriv->devs) { DECLARE_BITMAP(devs_closed, COMEDI_NUM_BOARD_MINORS); memset(&devs_closed, 0, sizeof(devs_closed)); - while (devpriv->ndevs-- && devpriv->devs) { + while (devpriv->ndevs--) { struct bonded_device *bdev; bdev = devpriv->devs[devpriv->ndevs]; |