From mboxrd@z Thu Jan 1 00:00:00 1970 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2nVjOv9PsLdyhWbCu4TjcFSRCs0DUv8ReOK+2kXR4Uw=; b=2OIj79oOnUXdAUD66Dypa9uWdtVJvm6pZfGwThNOdcCMHlC9p6uqo7uJRIzvTDY+31 /zUz6Xa1HOtEc3EV1BsMvJxiydvUZC29FNCddetI4sw3apmnawVtCCFvm62BqUWvjHJD 15yYPweoJOSdY/gexQ7zeYFIS1yiFTKjxPyGnLjrzFMGPg8OnsYJAdUfTZXHX1+lqHzC GICYIB/bpQjRFAFmPGABvm0g2Mmh+NzjJxrrL3+qgj1dUTqh7+S8/9C2GDu8Yt6VM9/R 6hhm2BsMjy4KALPTjqrKtEzb+E9OfIIltg9EZQRCQCZIxwk4KT4yGyduNlPw1iAAyYTy yUVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2nVjOv9PsLdyhWbCu4TjcFSRCs0DUv8ReOK+2kXR4Uw=; b=Z38KDAC9LR/km+tRN5Do1JocIgvuiM+SiimQNk8U1tanTTvPHPtgJTbCman8WZA2V9 qULQnICpTQc1iYxKGw6bRdNYStX8pRNnIwJrwhBzRTdeLRfK3qOZ7EsbPEvXhAcsKKic HK4zIrrFEQ188lQtnoAenslJsMlevhBy+NiumFe4ClOJPU7GDHTQY29fg+PXvezk6CtX SvalLqHdvc4c8yzIhPi7//EhZwt5/4cSQv888A3EBJaGBFzuOnJhHlr8Xi5IS8Llcizq B2JI7woul0wJVEuY9aZPRyr94VfMhgoCjjba7eDJ55ib+XE/T7PHhJqOhV+T3/G8g0RW V+RA== X-Gm-Message-State: AHYfb5j4hBOzixmx0hvAZDRKFXn1QSsL6t+WVx0QUyGLIba6tyg+2NP6 xjl5zoNRfk7rJ+4K X-Received: by 10.99.120.68 with SMTP id t65mr19727013pgc.104.1503374352911; Mon, 21 Aug 2017 20:59:12 -0700 (PDT) Received: from xeon-e3 (76-14-207-240.or.wavecable.com. [76.14.207.240]) by smtp.gmail.com with ESMTPSA id t14sm23230788pgr.94.2017.08.21.20.59.12 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 21 Aug 2017 20:59:12 -0700 (PDT) Date: Mon, 21 Aug 2017 20:59:05 -0700 From: Stephen Hemminger To: Yipeng Wang 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 Message-ID: <20170821205905.1704ec88@xeon-e3> In-Reply-To: <1503361193-36699-2-git-send-email-yipeng1.wang@intel.com> 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 Subject: Re: [dpdk-dev] [PATCH 1/7] member: implement main API X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Aug 2017 03:59:14 -0000 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.