[dpdk-stable] [dpdk-dev] [PATCH] eal/option: fix option register duplicate detection

David Marchand david.marchand at redhat.com
Mon Dec 17 11:19:29 CET 2018


On Mon, Dec 17, 2018 at 10:26 AM Gaetan Rivet <gaetan.rivet at 6wind.com>
wrote:

> Missing brackets around the if means that the loop will end at its first
> iteration.
>
> Cc: stable at dpdk.org
>
> Fixes: 2395332798d0 ("eal: add option register infrastructure")
> Signed-off-by: Gaetan Rivet <gaetan.rivet at 6wind.com>
> ---
>  lib/librte_eal/common/rte_option.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/lib/librte_eal/common/rte_option.c
> b/lib/librte_eal/common/rte_option.c
> index 02d59a869..eefb8b923 100644
> --- a/lib/librte_eal/common/rte_option.c
> +++ b/lib/librte_eal/common/rte_option.c
> @@ -35,10 +35,11 @@ void __rte_experimental
>  rte_option_register(struct rte_option *opt)
>  {
>         TAILQ_FOREACH(option, &rte_option_list, next) {
> -               if (strcmp(opt->opt_str, option->opt_str) == 0)
> +               if (strcmp(opt->opt_str, option->opt_str) == 0) {
>                         RTE_LOG(INFO, EAL, "Option %s has already been
> registered.",
>                                         opt->opt_str);
>                         return;
> +               }
>         }
>
>         TAILQ_INSERT_HEAD(&rte_option_list, opt, next);
>

Reviewed-by: David Marchand <david.marchand at redhat.com>

Different topic but having a return code would be better than a simple log.

-- 
David Marchand


More information about the stable mailing list