summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTonghao Zhang <xiangxia.m.yue@gmail.com>2020-04-24 02:08:04 +0200
committerDavid S. Miller <davem@davemloft.net>2020-04-24 03:26:11 +0200
commita8e387384f554ea0b63889a7682ffcddee24df8b (patch)
treeb885b151d62bde066f5d710a6c873fa8a9410e6f
parentnet: openvswitch: set max limitation to meters (diff)
downloadlinux-a8e387384f554ea0b63889a7682ffcddee24df8b.tar.xz
linux-a8e387384f554ea0b63889a7682ffcddee24df8b.zip
net: openvswitch: remove the unnecessary check
Before invoking the ovs_meter_cmd_reply_stats, "meter" was 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> Acked-by: Pravin B Shelar <pshelar@ovn.org> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/openvswitch/meter.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/net/openvswitch/meter.c b/net/openvswitch/meter.c
index 372f4565872d..b7893b0d6423 100644
--- a/net/openvswitch/meter.c
+++ b/net/openvswitch/meter.c
@@ -242,12 +242,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;