* [PATCH] Staging: silicom: fix dangerous if condition in bpctl_mod.c
@ 2014-04-01 13:03 Neil Armstrong
0 siblings, 0 replies; only message in thread
From: Neil Armstrong @ 2014-04-01 13:03 UTC (permalink / raw)
To: Greg Kroah-Hartman, devel; +Cc: linux-kernel, chad, viro, tulinizer
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>
---
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 6b9365b..3b4db2a 100644
--- a/drivers/staging/silicom/bpctl_mod.c
+++ b/drivers/staging/silicom/bpctl_mod.c
@@ -220,8 +220,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)
--
1.7.0.4
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2014-04-01 13:03 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-01 13:03 [PATCH] Staging: silicom: fix dangerous if condition in bpctl_mod.c Neil Armstrong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox