2016-01-21 20:02, Jan Viktorin:
On Thu, 21 Jan 2016 12:57:10 +0100
David Marchand [off-list ref] wrote:
quoted
- 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.