Thread (48 messages) 48 messages, 5 authors, 2020-04-24
STALE2262d
Revisions (3)
  1. v2 current
  2. v3 [diff vs current]
  3. v4 [diff vs current]

[PATCH net-next v2 3/5] net: openvswitch: remove the unnecessary check

From: <hidden>
Date: 2020-04-18 17:25:20
Subsystem: networking [general], openvswitch, the rest · Maintainers: "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Aaron Conole, Eelco Chaudron, Ilya Maximets, Linus Torvalds

From: Tonghao Zhang <redacted>

Before calling the ovs_meter_cmd_reply_stats, "meter"
is checked, so don't check it agin in that function.

Cc: Pravin B Shelar <redacted>
Cc: Andy Zhou <redacted>
Signed-off-by: Tonghao Zhang <redacted>
---
 net/openvswitch/meter.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/net/openvswitch/meter.c b/net/openvswitch/meter.c
index 1b6776f9c109..f552c64ae8df 100644
--- a/net/openvswitch/meter.c
+++ b/net/openvswitch/meter.c
@@ -229,12 +229,11 @@ static int ovs_meter_cmd_reply_stats(struct sk_buff *reply, u32 meter_id,
 	if (nla_put_u32(reply, OVS_METER_ATTR_ID, meter_id))
 		goto error;
 
-	if (!meter)
-		return 0;
-
 	if (nla_put(reply, OVS_METER_ATTR_STATS,
-		    sizeof(struct ovs_flow_stats), &meter->stats) ||
-	    nla_put_u64_64bit(reply, OVS_METER_ATTR_USED, meter->used,
+		    sizeof(struct ovs_flow_stats), &meter->stats))
+		goto error;
+
+	if (nla_put_u64_64bit(reply, OVS_METER_ATTR_USED, meter->used,
 			      OVS_METER_ATTR_PAD))
 		goto error;
 
-- 
2.23.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help