[dpdk-dev] [PATCH 1/7] member: implement main API

Stephen Hemminger stephen at networkplumber.org
Tue Aug 22 05:59:05 CEST 2017


On Mon, 21 Aug 2017 17:19:47 -0700
Yipeng Wang <yipeng1.wang at intel.com> wrote:

> +int
> +rte_member_lookup(const void *ss, const void *key,
> +		MEMBER_SET_TYPE *set_id)
> +{
> +	const struct rte_member_setsum *setsum = ss;
> +	if (setsum == NULL || key == NULL || set_id == NULL)
> +		return -EINVAL;
> +
> +	int ret = 0;

Don't needlessly initialize all variable.
In all code paths, ret is set.

In fact you could just make all cases of the switch into return
and  compiler could optimize it as a tail call.


More information about the dev mailing list