Thread (16 messages) 16 messages, 3 authors, 2016-01-27

Re: [dpdk-dev,1/2] ethdev: remove useless null checks

From: Thomas Monjalon <hidden>
Date: 2016-01-22 09:12:48

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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help