From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Viktorin Subject: Re: [dpdk-dev,1/2] ethdev: remove useless null checks Date: Thu, 21 Jan 2016 20:02:25 +0100 Message-ID: <20160121200225.60cffcfd@pcviktorin.fit.vutbr.cz> References: <1453377431-25850-2-git-send-email-david.marchand@6wind.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: dev@dpdk.org To: David Marchand Return-path: Received: from wes1-so2.wedos.net (wes1-so2.wedos.net [46.28.106.16]) by dpdk.org (Postfix) with ESMTP id 3EE288E95 for ; Thu, 21 Jan 2016 20:00:28 +0100 (CET) In-Reply-To: <1453377431-25850-2-git-send-email-david.marchand@6wind.com> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Thu, 21 Jan 2016 12:57:10 +0100 David Marchand wrote: > We are in static functions and those passed arguments can't be NULL. > > Signed-off-by: David Marchand > > --- > lib/librte_ether/rte_ethdev.c | 15 --------------- > 1 file changed, 15 deletions(-) > > diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c > index af990e2..951fb1c 100644 > --- a/lib/librte_ether/rte_ethdev.c > +++ b/lib/librte_ether/rte_ethdev.c > @@ -220,9 +220,6 @@ rte_eth_dev_create_unique_device_name(char *name, size_t size, > { > int ret; > > - 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... > [snip]