From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Hemminger Subject: Re: [PATCH 1/7] member: implement main API Date: Mon, 21 Aug 2017 20:59:05 -0700 Message-ID: <20170821205905.1704ec88@xeon-e3> References: <1503361193-36699-1-git-send-email-yipeng1.wang@intel.com> <1503361193-36699-2-git-send-email-yipeng1.wang@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: vincent.jardin@6wind.com, bruce.richardson@intel.com, konstantin.ananyev@intel.com, thomas@monjalon.net, dev@dpdk.org, charlie.tai@intel.com, sameh.gobriel@intel.com, ren.wang@intel.com To: Yipeng Wang Return-path: Received: from mail-pg0-f52.google.com (mail-pg0-f52.google.com [74.125.83.52]) by dpdk.org (Postfix) with ESMTP id A678C7CFD for ; Tue, 22 Aug 2017 05:59:13 +0200 (CEST) Received: by mail-pg0-f52.google.com with SMTP id m133so28327460pga.5 for ; Mon, 21 Aug 2017 20:59:13 -0700 (PDT) In-Reply-To: <1503361193-36699-2-git-send-email-yipeng1.wang@intel.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Mon, 21 Aug 2017 17:19:47 -0700 Yipeng Wang wrote: > +int > +rte_member_lookup(const void *ss, const void *key, > + MEMBER_SET_TYPE *set_id) > +{ > + const struct rte_member_setsum *setsum = ss; > + if (setsum == NULL || key == NULL || set_id == NULL) > + return -EINVAL; > + > + int ret = 0; Don't needlessly initialize all variable. In all code paths, ret is set. In fact you could just make all cases of the switch into return and compiler could optimize it as a tail call.