Staging: silicom: fix dangerous if condition in bpctl_mod.c
authorNeil Armstrong <superna9999@gmail.com>
Tue, 1 Apr 2014 13:03:44 +0000 (15:03 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 25 Apr 2014 22:33:35 +0000 (15:33 -0700)
checkpatch script returns the following warning:
ERROR: do not use assignment in if condition
+                       if (((dev_num = get_dev_idx(dev->ifindex)) ==
            -1) |

This patch fixes the if condition by splitting it.

Signed-off-by: Neil Armstrong <superna9999@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/silicom/bpctl_mod.c

index 530d6214de74f5d3f029fd3e0b092bc8f554a6b4..7f3d884d4ddd41b94684e01b314e7acf739b6439 100644 (file)
@@ -219,8 +219,12 @@ static int bp_device_event(struct notifier_block *unused,
                        if (netif_carrier_ok(dev))
                                return NOTIFY_DONE;
 
-                       if (((dev_num = get_dev_idx(dev->ifindex)) == -1) ||
-                           (!(pbpctl_dev = &bpctl_dev_arr[dev_num])))
+                       dev_num = get_dev_idx(dev->ifindex);
+                       if (dev_num == -1)
+                               return NOTIFY_DONE;
+
+                       pbpctl_dev = &bpctl_dev_arr[dev_num];
+                       if (!pbpctl_dev)
                                return NOTIFY_DONE;
 
                        if ((is_bypass_fn(pbpctl_dev)) == 1)
This page took 0.027889 seconds and 5 git commands to generate.