From patchwork Fri Sep 8 01:51:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: duanjiong X-Patchwork-Id: 811281 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="ojIqTBRQ"; dkim-atps=neutral Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xpL0L2xn3z9sDB for ; Fri, 8 Sep 2017 11:51:46 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 3DE8BABC; Fri, 8 Sep 2017 01:51:43 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id A3589486 for ; Fri, 8 Sep 2017 01:51:41 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-lf0-f65.google.com (mail-lf0-f65.google.com [209.85.215.65]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 17C40E0 for ; Fri, 8 Sep 2017 01:51:41 +0000 (UTC) Received: by mail-lf0-f65.google.com with SMTP id q132so516748lfe.4 for ; Thu, 07 Sep 2017 18:51:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=pGp63nAnXDw6eWvtnYiq8LFyT8jJN63aKsKD/2+QPRM=; b=ojIqTBRQQ+71lJY8lbc0uiBz2HXsJmh/8LCuXTRZ3mKqFn0Zoj9uiYPINFCQE8G5Tp kY3Ig3CAgqIeILr8GClKmcjQkrgYTQuQDDA/VzQRLbb9C6jCqL8w0IAG/9xkYyp4uZSj DcTp5wfZxFmDLek6YTH6f7iz3feD0tixw4Fv19tyMerZgZXuF/j7W1cqj+FIu2OE6dSA LrvW2829cBXKHls0kruIZTcHMcy4sJcv1BDFcqyzFF2GXBhhELZGcNiiyAIcQsKcAgRN Mr2XJKW9xYjTzoiQocZ0JHuXytBafDEMY0VEvouDz2edA8Wmz7Ay1OQ5e1ykNq2RSCRL VtTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=pGp63nAnXDw6eWvtnYiq8LFyT8jJN63aKsKD/2+QPRM=; b=ILmlFWwDA7u1OIuJd8xnuPtH1XL99sSZIZbYMzEXu3gsh4V3PNU9l1JwzcjF/mmRXE DGhXZi/GX1+KDz3CD4JP9XtQxU7xYk9YEXHRUk1hx72kT1PWAYvMBCDEh18vV3K6V3L2 ubVHEgAhU/FakuG7JOIUKeQaocoPyMirmx4R1A6gZao/w+VXn+LQLpK2wadjiSA17g0s +2ru/560lnhWYDjUeMri2rHeav4PkeICCMOY4w3gR3ebcKOx1HHZFBbpePCAGIxVwl+L lxunh7ON61o/kllgXqLBIKzXGpr4NhLO2T0EIUXVi/IgbNhyNe3WhtBFxK34zjO4ZA5G Xteg== X-Gm-Message-State: AHPjjUgO46TMpCc7CO10I5HWY2/IKYC4lXJlNuTOFX4Rz0tJsQvQ3GOs 7Wes+1vM6B0rdJa5IkKmyJ47IjNqf5tm X-Google-Smtp-Source: ADKCNb5L2MWeGJu+0XD9/iQeQpeiu6mwNsXTaZf97vJswgHdF9+bVdJlzR6jR3RASoIYkZ8FpF7Ef/Mdv4NBud0iR9s= X-Received: by 10.46.9.81 with SMTP id 78mr370781ljj.175.1504835499322; Thu, 07 Sep 2017 18:51:39 -0700 (PDT) MIME-Version: 1.0 Received: by 10.46.92.198 with HTTP; Thu, 7 Sep 2017 18:51:38 -0700 (PDT) From: Duan Jiong Date: Fri, 8 Sep 2017 09:51:38 +0800 Message-ID: To: dev@openvswitch.org X-Spam-Status: No, score=0.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM autolearn=disabled version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH] put bundle_lookup ahead to simplify the code X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org From ba48275f8bb30ed2888c16426726ee9cb3407cd1 Mon Sep 17 00:00:00 2001 From: Duan Jiong Date: Fri, 8 Sep 2017 09:48:59 +0800 Subject: [PATCH] put bundle_lookup ahead to simplify the code Signed-off-by: Duan Jiong Reviewed-by: Greg Rose --- ofproto/ofproto-dpif.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index 1a8e829..293780f 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -3011,15 +3011,16 @@ bundle_set(struct ofproto *ofproto_, void *aux, size_t i; bool ok; + bundle = bundle_lookup(ofproto, aux); + if (!s) { - bundle_destroy(bundle_lookup(ofproto, aux)); + bundle_destroy(bundle); return 0; } ovs_assert(s->n_slaves == 1 || s->bond != NULL); ovs_assert((s->lacp != NULL) == (s->lacp_slaves != NULL)); - bundle = bundle_lookup(ofproto, aux); if (!bundle) { bundle = xmalloc(sizeof *bundle);