From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f49.google.com (mail-wm0-f49.google.com [74.125.82.49]) by dpdk.org (Postfix) with ESMTP id C1F928EA1 for ; Fri, 22 Jan 2016 10:12:48 +0100 (CET) Received: by mail-wm0-f49.google.com with SMTP id l65so252449326wmf.1 for ; Fri, 22 Jan 2016 01:12:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:organization:user-agent :in-reply-to:references:mime-version:content-transfer-encoding :content-type; bh=8sa8X6JXGoiL42c2qDIVz/xX3Yn6kEM3CzVGFiG0J3c=; b=FGbBIWauxjC8V3vHWxhSHcU3QR/LbeFvxzeGnQABwO+Uw7wwECbPCuSjxgHk8ey72E eXwiL7VRvbqFyHJLDDx5EFXK9IjGnwiQ77JvikPSJ4TybcbTxu4iWcvMjBQS9uDzdmKK 53shI9lSh+sLaczJQPlXiLDKzqBZ90NAjk9hvE5b4OPQGQEBCV8lACQG0Wf2GfEywnPw eNIHLppsSuE8DPUTvGOOzb/Q+WScNfRS3AeFugyivFXcXzj6g2BPUmiI3ogMtN7ap0Kf df4qlRU72AZ8GXuBy31+guz4VDN2q4loHBVioP5yusTyFsBiIreImC3N1+QTcPQabizH i5Pw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:organization :user-agent:in-reply-to:references:mime-version :content-transfer-encoding:content-type; bh=8sa8X6JXGoiL42c2qDIVz/xX3Yn6kEM3CzVGFiG0J3c=; b=b0U35a5dhriEbaJPJRM9tCHgeNSQlmEb67R0sffTH9/i++Yws5MZ9D52rOUDTXWGaZ MSoaCL04ogsN4EAO30eRhJqJshMYLt1V1SjD5SU6AtP27fepuuV3INX0LikPDXtqYqK9 ae22et2hCsIahxbrlXxz5o5SCZzfuqr7W/uFQKZK8PpdougFV0ACEsrMVXZbjjxqJXKf V1LknlW5f4V8Pvo5Hc6rlIeaBAPIa7QPdJuuQ++fNvXkpMo7CWaTPm0348IXehppTYe+ dY0CjRz3DAvUhhMr1XxrCMw2g3OEcJf91a44C3HlfR6bd9+3uojO6JHC0MpCB7ORMExm /mkA== X-Gm-Message-State: AG10YOR+B+zsiq6RjQJd5XS7BMxEmyU1ykwk5p/pFj2TtDZUe1SFvmT0DjYbxzkipkZQzDVr X-Received: by 10.28.153.148 with SMTP id b142mr2452370wme.5.1453453968616; Fri, 22 Jan 2016 01:12:48 -0800 (PST) Received: from xps13.localnet (136-92-190-109.dsl.ovh.fr. [109.190.92.136]) by smtp.gmail.com with ESMTPSA id k130sm2024527wmg.6.2016.01.22.01.12.47 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 22 Jan 2016 01:12:47 -0800 (PST) From: Thomas Monjalon To: Jan Viktorin Date: Fri, 22 Jan 2016 10:11:47 +0100 Message-ID: <14115211.gcWZQ474Ox@xps13> Organization: 6WIND User-Agent: KMail/4.14.10 (Linux/4.1.6-1-ARCH; KDE/4.14.11; x86_64; ; ) In-Reply-To: <20160121200225.60cffcfd@pcviktorin.fit.vutbr.cz> References: <1453377431-25850-2-git-send-email-david.marchand@6wind.com> <20160121200225.60cffcfd@pcviktorin.fit.vutbr.cz> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Cc: dev@dpdk.org Subject: Re: [dpdk-dev] [dpdk-dev,1/2] ethdev: remove useless null checks X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2016 09:12:49 -0000 2016-01-21 20:02, Jan Viktorin: > On Thu, 21 Jan 2016 12:57:10 +0100 > David Marchand wrote: > > - if ((name == NULL) || (pci_dev == NULL)) > > - return -EINVAL; > > Do you use a kind of assert in DPDK? The patch looks OK, however, I > would prefer something like > > assert_not_null(name); > assert_not_null(pci_dev); > > Usually, if some outer code is broken by mistake, the assert catches > such an issue. At the same time, it documents the code by telling > "this must never be NULL here". I agree, that returning -EINVAL for > this kind of check is incorrect. > > Same for other changes... For this patch, I agree to remove useless checks. For the other checks, EINVAL seems to be the right error code. And yes you are right, we could replace most of EINVAL returns by a kind of assert. RTE_VERIFY would be appropriate.