mirror of https://gitee.com/openkylin/linux.git
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>
This commit is contained in:
parent
c2af5b9681
commit
7b8cbe92be
|
@ -339,11 +339,11 @@ static void bonding_detach(struct comedi_device *dev)
|
||||||
{
|
{
|
||||||
struct comedi_bond_private *devpriv = dev->private;
|
struct comedi_bond_private *devpriv = dev->private;
|
||||||
|
|
||||||
if (devpriv) {
|
if (devpriv && devpriv->devs) {
|
||||||
DECLARE_BITMAP(devs_closed, COMEDI_NUM_BOARD_MINORS);
|
DECLARE_BITMAP(devs_closed, COMEDI_NUM_BOARD_MINORS);
|
||||||
|
|
||||||
memset(&devs_closed, 0, sizeof(devs_closed));
|
memset(&devs_closed, 0, sizeof(devs_closed));
|
||||||
while (devpriv->ndevs-- && devpriv->devs) {
|
while (devpriv->ndevs--) {
|
||||||
struct bonded_device *bdev;
|
struct bonded_device *bdev;
|
||||||
|
|
||||||
bdev = devpriv->devs[devpriv->ndevs];
|
bdev = devpriv->devs[devpriv->ndevs];
|
||||||
|
|
Loading…
Reference in New Issue