From: Michael Baum Date: Tue, 1 Mar 2022 11:09:35 +0000 (+0200) Subject: common/mlx5: fix default devargs initialization X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=2c75b9bcd5889a09f0945ee48d8d032de1fa9c82;p=dpdk.git common/mlx5: fix default devargs initialization Device arguments list is provided along with its identifier as part of EAL arguments. The arguments specified in the list are taken from it, and the rest is initialized to the default values. When no list is provided at all, all arguments should have been initialized to their default values. However, they are mistakenly initialized to zero which may be a valid value for some. This patch initializes the default values before checking whether arguments have been specified. Bugzilla ID: 945 Fixes: a729d2f093e9 ("common/mlx5: refactor devargs management") Signed-off-by: Michael Baum Acked-by: Matan Azrad --- diff --git a/drivers/common/mlx5/mlx5_common.c b/drivers/common/mlx5/mlx5_common.c index 94c303ce81..ef1604d223 100644 --- a/drivers/common/mlx5/mlx5_common.c +++ b/drivers/common/mlx5/mlx5_common.c @@ -326,8 +326,6 @@ mlx5_common_config_get(struct mlx5_kvargs_ctrl *mkvlist, }; int ret = 0; - if (mkvlist == NULL) - return 0; /* Set defaults. */ config->mr_ext_memseg_en = 1; config->mr_mempool_reg_en = 1; @@ -335,6 +333,8 @@ mlx5_common_config_get(struct mlx5_kvargs_ctrl *mkvlist, config->dbnc = MLX5_ARG_UNSET; config->device_fd = MLX5_ARG_UNSET; config->pd_handle = MLX5_ARG_UNSET; + if (mkvlist == NULL) + return 0; /* Process common parameters. */ ret = mlx5_kvargs_process(mkvlist, params, mlx5_common_args_check_handler, config);