[dpdk-dev] [dpdk-dev,1/2] ethdev: remove useless null checks
Jan Viktorin
viktorin at rehivetech.com
Thu Jan 21 20:02:25 CET 2016
On Thu, 21 Jan 2016 12:57:10 +0100
David Marchand <david.marchand at 6wind.com> wrote:
> We are in static functions and those passed arguments can't be NULL.
>
> Signed-off-by: David Marchand <david.marchand at 6wind.com>
>
> ---
> 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]
More information about the dev
mailing list