diff options
author | Neil Armstrong <superna9999@gmail.com> | 2014-04-01 15:03:44 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-04-25 15:33:35 -0700 |
commit | 2f4285d17d3a5ae42e2811005dbcd4818d5d6ebe (patch) | |
tree | 9e368f937d297b11bdb0ed31ede4a762ba9f17ba /drivers/staging/silicom/bpctl_mod.c | |
parent | bfdaa39f42e6f7b364f3c499af9a67b1d8186c8b (diff) | |
download | op-kernel-dev-2f4285d17d3a5ae42e2811005dbcd4818d5d6ebe.zip op-kernel-dev-2f4285d17d3a5ae42e2811005dbcd4818d5d6ebe.tar.gz |
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: Neil Armstrong <superna9999@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/silicom/bpctl_mod.c')
-rw-r--r-- | drivers/staging/silicom/bpctl_mod.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/staging/silicom/bpctl_mod.c b/drivers/staging/silicom/bpctl_mod.c index 530d621..7f3d884 100644 --- a/drivers/staging/silicom/bpctl_mod.c +++ b/drivers/staging/silicom/bpctl_mod.c @@ -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) |