diff mbox series

[net-next,v1,3/3] net: openvswitch: remove the unnecessary check

Message ID 1584969039-74113-3-git-send-email-xiangxia.m.yue@gmail.com
State Changes Requested
Delegated to: David Miller
Headers show
Series [net-next,v1,1/3] net: openvswitch: expand the meters number supported | expand

Commit Message

Tonghao Zhang March 23, 2020, 1:10 p.m. UTC
From: Tonghao Zhang <xiangxia.m.yue@gmail.com>

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

Cc: Pravin B Shelar <pshelar@ovn.org>
Cc: Andy Zhou <azhou@ovn.org>
Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
---
 net/openvswitch/meter.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/net/openvswitch/meter.c b/net/openvswitch/meter.c
index 5efd48e024f0..03b39b0eb4ea 100644
--- a/net/openvswitch/meter.c
+++ b/net/openvswitch/meter.c
@@ -212,12 +212,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;