Commit 2f4285d1 authored by Neil Armstrong's avatar Neil Armstrong Committed by Greg Kroah-Hartman

Staging: silicom: fix dangerous if condition in bpctl_mod.c

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: default avatarNeil Armstrong <superna9999@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent bfdaa39f
...@@ -219,8 +219,12 @@ static int bp_device_event(struct notifier_block *unused, ...@@ -219,8 +219,12 @@ static int bp_device_event(struct notifier_block *unused,
if (netif_carrier_ok(dev)) if (netif_carrier_ok(dev))
return NOTIFY_DONE; return NOTIFY_DONE;
if (((dev_num = get_dev_idx(dev->ifindex)) == -1) || dev_num = get_dev_idx(dev->ifindex);
(!(pbpctl_dev = &bpctl_dev_arr[dev_num]))) if (dev_num == -1)
return NOTIFY_DONE;
pbpctl_dev = &bpctl_dev_arr[dev_num];
if (!pbpctl_dev)
return NOTIFY_DONE; return NOTIFY_DONE;
if ((is_bypass_fn(pbpctl_dev)) == 1) if ((is_bypass_fn(pbpctl_dev)) == 1)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment