From patchwork Mon Mar 23 13:10:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tonghao Zhang X-Patchwork-Id: 1263254 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.137; helo=fraxinus.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=fgT3adn0; dkim-atps=neutral Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48qNPd52k3z9sQt for ; Sun, 29 Mar 2020 02:46:44 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id B8B06870D2; Sat, 28 Mar 2020 15:46:42 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fcfnf4zA_19J; Sat, 28 Mar 2020 15:46:42 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by fraxinus.osuosl.org (Postfix) with ESMTP id 4C84387141; Sat, 28 Mar 2020 15:46:42 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 3701CC18DA; Sat, 28 Mar 2020 15:46:42 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 02939C0177 for ; Sat, 28 Mar 2020 15:46:41 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 25A8387C74 for ; Sat, 28 Mar 2020 15:46:40 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id UdyS6Do7NJAl for ; Sat, 28 Mar 2020 15:46:38 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pj1-f66.google.com (mail-pj1-f66.google.com [209.85.216.66]) by whitealder.osuosl.org (Postfix) with ESMTPS id 41BC7810C0 for ; Sat, 28 Mar 2020 15:46:38 +0000 (UTC) Received: by mail-pj1-f66.google.com with SMTP id l36so5236211pjb.3 for ; Sat, 28 Mar 2020 08:46:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=/F5soHZdX+upsGd/QwghyKOQFTKWDBPpvRaxS81m59o=; b=fgT3adn0fs7zZUrYAXaxjm17QmCkgA1prZ9HdbFtvgsnyMAVvvPQnlVzKvAu6Y9HrQ c51SHqnG4rcvxUqlK3lTF1QLJzSj8nKQkCS2XSqIzj7G/LcblWNEWUNuF/qJU3O1SIZR xCtTQjbVLmKlGngezpqy4rYKBqj0FE7HjzxYaRtjilWZSVpfdpFEojpFpHrSU58aDhtD rkXNrGqqcoC5IjUCSEgmwEuZoHfIIe3Y6jHwCzITUJycFoJDzDhmNI4IW+rTpKW1eYgt bWclqxfYm7yuhuYCV4ksFhQBH8kHbu+Z93nyuPe5SKX/3WNZ7DMJGNe2hP8wym2ZD+3n +MVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=/F5soHZdX+upsGd/QwghyKOQFTKWDBPpvRaxS81m59o=; b=Mv/KxVa4R6OOJCmuzHpIj1EnhPC9hd2RDKtDOPVRWUHo2vypXdEYmy72lYQa8lQJ4i z+52lGGTvSUdwj8Sqa3bBNMM7aczlDT9I/O6hcGlyhax9pn6GBipQ35uyPxwqTx6HXGB XVoIHwkdPSE0uQQzeo5Vz0/54kyXfY4Y16gV5U9cp9dZBE/+kpZCo9gFfN2/ZNcUWQzF qr5AOZYt1pYCdgdHHFAvp9qnRx36qvHVjfARTa0bkzZ8jNIr1aPF29Fc15iJsTKPiTKu btRxsGFW18dZq4E2pxKDt8RD/7KjXVukSS/O1ywC8JQ2d/YsHNxuoDimXwJC73MBsyv8 p51g== X-Gm-Message-State: ANhLgQ1YroaAqnndUp9u8rg8dvuTuatAmi1YkZ0zoYfMs5aMQlBY4C99 oeIW4uHyeLosHVE2xFc3ykI= X-Google-Smtp-Source: ADFU+vsZNBWoCb5qSXtAEzHIqsSU7xXoLzKUGeFJMtO1JC865/HSednvyZjt2Nl4Y4b7qCy3YESQNQ== X-Received: by 2002:a17:90a:218b:: with SMTP id q11mr5534138pjc.163.1585410397779; Sat, 28 Mar 2020 08:46:37 -0700 (PDT) Received: from local.opencloud.tech.localdomain ([115.171.63.184]) by smtp.gmail.com with ESMTPSA id q185sm6375218pfb.154.2020.03.28.08.46.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 28 Mar 2020 08:46:37 -0700 (PDT) From: xiangxia.m.yue@gmail.com To: pshelar@ovn.org Date: Mon, 23 Mar 2020 21:10:39 +0800 Message-Id: <1584969039-74113-3-git-send-email-xiangxia.m.yue@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1584969039-74113-1-git-send-email-xiangxia.m.yue@gmail.com> References: <1584969039-74113-1-git-send-email-xiangxia.m.yue@gmail.com> Cc: dev@openvswitch.org, netdev@vger.kernel.org Subject: [ovs-dev] [PATCH net-next v1 3/3] net: openvswitch: remove the unnecessary check X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" From: Tonghao Zhang Before calling the ovs_meter_cmd_reply_stats, "meter" is checked, so don't check it agin in that function. Cc: Pravin B Shelar Cc: Andy Zhou Signed-off-by: Tonghao Zhang --- 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 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;