Re: [dpdk-dev,1/2] ethdev: remove useless null checks
From: Jan Viktorin <hidden>
Date: 2016-01-21 19:00:28
On Thu, 21 Jan 2016 12:57:10 +0100 David Marchand [off-list ref] wrote:
quoted hunk ↗ jump to hunk
We are in static functions and those passed arguments can't be NULL. Signed-off-by: David Marchand <redacted> --- 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]