From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 294DD45BA1; Wed, 30 Oct 2024 05:00:39 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1614642FB9; Wed, 30 Oct 2024 05:00:39 +0100 (CET) Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by mails.dpdk.org (Postfix) with ESMTP id C155C42EC5 for ; Wed, 30 Oct 2024 05:00:34 +0100 (CET) Received: from mail.maildlp.com (unknown [172.19.163.252]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4XdYJB5RJTz1T9LK; Wed, 30 Oct 2024 11:58:18 +0800 (CST) Received: from dggpeml500024.china.huawei.com (unknown [7.185.36.10]) by mail.maildlp.com (Postfix) with ESMTPS id 33D461800A5; Wed, 30 Oct 2024 12:00:29 +0800 (CST) Received: from localhost.localdomain (10.50.165.33) by dggpeml500024.china.huawei.com (7.185.36.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Wed, 30 Oct 2024 12:00:28 +0800 From: Chengwen Feng To: , , CC: , Chengwen Feng , Gagandeep Singh , Hemant Agrawal , Nicolas Chautru , Rosen Xu , Kai Ji , Kevin Laatz , Bruce Richardson , Abdullah Sevincer , Srikanth Yalavarthi , Ajit Khaparde , Somnath Kotur , Chas Williams , "Min Hu (Connor)" , Gaetan Rivet , Jie Hai , Vladimir Medvedkin , Ian Stokes , Anatoly Burakov , Chaoyong He , Christian Koue Muf , Serhii Iliushyk , Tetsuya Mukawa , Cristian Dumitrescu , Stephen Hemminger , Jiawen Wu , Jian Wang , Maxime Coquelin , Chenbo Xia , Sachin Saxena , Vijay Kumar Srivastava , Fan Zhang , Ashish Gupta , Akhil Goyal , Andrew Rybchenko Subject: [PATCH] dpdk: remove redundant null check when parse kvargs Date: Wed, 30 Oct 2024 04:01:08 +0000 Message-ID: <20241030040109.34504-1-fengchengwen@huawei.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpeml500024.china.huawei.com (7.185.36.10) X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org As rte_kvargs_process() API already restrict only process key=value, so the callback will never exist 'value == NULL' case. This commit remove such above 'value == NULL' check. Plus, the net/tap driver should use rte_kvargs_process_opt() because it will treat only-key as normal case, so this commit also contain it. Signed-off-by: Chengwen Feng --- drivers/baseband/la12xx/bbdev_la12xx.c | 2 +- drivers/baseband/null/bbdev_null.c | 2 +- .../baseband/turbo_sw/bbdev_turbo_software.c | 2 +- drivers/bus/ifpga/ifpga_common.h | 4 +-- drivers/crypto/scheduler/scheduler_pmd.c | 2 -- drivers/dma/skeleton/skeleton_dmadev.c | 2 +- drivers/event/dlb2/dlb2.c | 32 +++++++++---------- drivers/ml/cnxk/cn10k_ml_dev.c | 2 +- drivers/net/bnxt/bnxt_ethdev.c | 22 ++++++------- drivers/net/bonding/rte_eth_bond_args.c | 16 +++++----- drivers/net/failsafe/failsafe_args.c | 4 +-- drivers/net/hns3/hns3_common.c | 11 ++----- drivers/net/iavf/iavf_ethdev.c | 2 +- drivers/net/ice/ice_ethdev.c | 6 ++-- drivers/net/ixgbe/ixgbe_ethdev.c | 2 +- drivers/net/nfp/nfp_ethdev.c | 3 -- drivers/net/ntnic/ntutil/nt_util.c | 2 +- drivers/net/null/rte_eth_null.c | 6 ++-- drivers/net/softnic/rte_eth_softnic.c | 6 ++-- drivers/net/tap/rte_eth_tap.c | 16 +++++----- drivers/net/txgbe/txgbe_ethdev.c | 2 +- drivers/net/vhost/rte_eth_vhost.c | 5 +-- drivers/net/virtio/virtio_ethdev.c | 4 +-- drivers/net/virtio/virtio_pci_ethdev.c | 2 +- drivers/net/virtio/virtio_user_ethdev.c | 4 +-- drivers/raw/ifpga/ifpga_rawdev.c | 2 +- drivers/raw/skeleton/skeleton_rawdev.c | 2 +- drivers/vdpa/ifc/ifcvf_vdpa.c | 2 +- drivers/vdpa/sfc/sfc_vdpa_filter.c | 2 +- lib/compressdev/rte_compressdev_pmd.c | 4 +-- lib/cryptodev/cryptodev_pmd.c | 4 +-- lib/ethdev/rte_ethdev_telemetry.c | 3 -- 32 files changed, 82 insertions(+), 98 deletions(-) diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c b/drivers/baseband/la12xx/bbdev_la12xx.c index 8928cdd89e..de6ed6c384 100644 --- a/drivers/baseband/la12xx/bbdev_la12xx.c +++ b/drivers/baseband/la12xx/bbdev_la12xx.c @@ -918,7 +918,7 @@ parse_u16_arg(const char *key, const char *value, void *extra_args) uint16_t *u16 = extra_args; uint64_t result; - if ((value == NULL) || (extra_args == NULL)) + if (extra_args == NULL) return -EINVAL; errno = 0; result = strtoul(value, NULL, 0); diff --git a/drivers/baseband/null/bbdev_null.c b/drivers/baseband/null/bbdev_null.c index dab416aa41..e16b666687 100644 --- a/drivers/baseband/null/bbdev_null.c +++ b/drivers/baseband/null/bbdev_null.c @@ -209,7 +209,7 @@ parse_u16_arg(const char *key, const char *value, void *extra_args) uint16_t *u16 = extra_args; unsigned int long result; - if ((value == NULL) || (extra_args == NULL)) + if (extra_args == NULL) return -EINVAL; errno = 0; result = strtoul(value, NULL, 0); diff --git a/drivers/baseband/turbo_sw/bbdev_turbo_software.c b/drivers/baseband/turbo_sw/bbdev_turbo_software.c index e527008524..5713907234 100644 --- a/drivers/baseband/turbo_sw/bbdev_turbo_software.c +++ b/drivers/baseband/turbo_sw/bbdev_turbo_software.c @@ -1842,7 +1842,7 @@ parse_u16_arg(const char *key, const char *value, void *extra_args) uint16_t *u16 = extra_args; unsigned int long result; - if ((value == NULL) || (extra_args == NULL)) + if (extra_args == NULL) return -EINVAL; errno = 0; result = strtoul(value, NULL, 0); diff --git a/drivers/bus/ifpga/ifpga_common.h b/drivers/bus/ifpga/ifpga_common.h index a41a1628f5..2c5d64df50 100644 --- a/drivers/bus/ifpga/ifpga_common.h +++ b/drivers/bus/ifpga/ifpga_common.h @@ -16,7 +16,7 @@ static inline int ifpga_get_string_arg(const char *key __rte_unused, const char *value, void *extra_args) { - if (!value || !extra_args) + if (!extra_args) return -EINVAL; *(char **)extra_args = strdup(value); @@ -31,7 +31,7 @@ static inline int ifpga_get_integer32_arg(const char *key __rte_unused, const char *value, void *extra_args) { - if (!value || !extra_args) + if (!extra_args) return -EINVAL; *(int *)extra_args = strtoull(value, NULL, 0); diff --git a/drivers/crypto/scheduler/scheduler_pmd.c b/drivers/crypto/scheduler/scheduler_pmd.c index 95ce893f05..fd20ac571d 100644 --- a/drivers/crypto/scheduler/scheduler_pmd.c +++ b/drivers/crypto/scheduler/scheduler_pmd.c @@ -345,8 +345,6 @@ parse_coremask_arg(const char *key __rte_unused, params->nb_wc = 0; - if (value == NULL) - return -1; /* Remove all blank characters ahead and after . * Remove 0x/0X if exists. */ diff --git a/drivers/dma/skeleton/skeleton_dmadev.c b/drivers/dma/skeleton/skeleton_dmadev.c index e287802eb9..a91cb9df22 100644 --- a/drivers/dma/skeleton/skeleton_dmadev.c +++ b/drivers/dma/skeleton/skeleton_dmadev.c @@ -644,7 +644,7 @@ skeldma_parse_lcore(const char *key __rte_unused, { int lcore_id; - if (value == NULL || opaque == NULL) + if (opaque == NULL) return -EINVAL; lcore_id = atoi(value); diff --git a/drivers/event/dlb2/dlb2.c b/drivers/event/dlb2/dlb2.c index 934fcafcfe..3e4f816332 100644 --- a/drivers/event/dlb2/dlb2.c +++ b/drivers/event/dlb2/dlb2.c @@ -264,7 +264,7 @@ set_producer_coremask(const char *key __rte_unused, { const char **mask_str = opaque; - if (value == NULL || opaque == NULL) { + if (opaque == NULL) { DLB2_LOG_ERR("NULL pointer"); return -EINVAL; } @@ -298,7 +298,7 @@ set_max_cq_depth(const char *key __rte_unused, int *max_cq_depth = opaque; int ret; - if (value == NULL || opaque == NULL) { + if (opaque == NULL) { DLB2_LOG_ERR("NULL pointer"); return -EINVAL; } @@ -327,7 +327,7 @@ set_max_enq_depth(const char *key __rte_unused, int *max_enq_depth = opaque; int ret; - if (value == NULL || opaque == NULL) { + if (opaque == NULL) { DLB2_LOG_ERR("NULL pointer"); return -EINVAL; } @@ -356,7 +356,7 @@ set_max_num_events(const char *key __rte_unused, int *max_num_events = opaque; int ret; - if (value == NULL || opaque == NULL) { + if (opaque == NULL) { DLB2_LOG_ERR("NULL pointer"); return -EINVAL; } @@ -383,7 +383,7 @@ set_num_dir_credits(const char *key __rte_unused, int *num_dir_credits = opaque; int ret; - if (value == NULL || opaque == NULL) { + if (opaque == NULL) { DLB2_LOG_ERR("NULL pointer"); return -EINVAL; } @@ -410,7 +410,7 @@ set_dev_id(const char *key __rte_unused, int *dev_id = opaque; int ret; - if (value == NULL || opaque == NULL) { + if (opaque == NULL) { DLB2_LOG_ERR("NULL pointer"); return -EINVAL; } @@ -430,7 +430,7 @@ set_poll_interval(const char *key __rte_unused, int *poll_interval = opaque; int ret; - if (value == NULL || opaque == NULL) { + if (opaque == NULL) { DLB2_LOG_ERR("NULL pointer"); return -EINVAL; } @@ -450,7 +450,7 @@ set_port_cos(const char *key __rte_unused, struct dlb2_port_cos *port_cos = opaque; int first, last, cos_id, i; - if (value == NULL || opaque == NULL) { + if (opaque == NULL) { DLB2_LOG_ERR("NULL pointer"); return -EINVAL; } @@ -520,7 +520,7 @@ set_sw_credit_quanta(const char *key __rte_unused, int *sw_credit_quanta = opaque; int ret; - if (value == NULL || opaque == NULL) { + if (opaque == NULL) { DLB2_LOG_ERR("NULL pointer"); return -EINVAL; } @@ -545,7 +545,7 @@ set_hw_credit_quanta(const char *key __rte_unused, int *hw_credit_quanta = opaque; int ret; - if (value == NULL || opaque == NULL) { + if (opaque == NULL) { DLB2_LOG_ERR("NULL pointer"); return -EINVAL; } @@ -565,7 +565,7 @@ set_default_depth_thresh(const char *key __rte_unused, int *default_depth_thresh = opaque; int ret; - if (value == NULL || opaque == NULL) { + if (opaque == NULL) { DLB2_LOG_ERR("NULL pointer"); return -EINVAL; } @@ -584,7 +584,7 @@ set_vector_opts_enab(const char *key __rte_unused, { bool *dlb2_vector_opts_enabled = opaque; - if (value == NULL || opaque == NULL) { + if (opaque == NULL) { DLB2_LOG_ERR("NULL pointer"); return -EINVAL; } @@ -604,7 +604,7 @@ set_default_ldb_port_allocation(const char *key __rte_unused, { bool *default_ldb_port_allocation = opaque; - if (value == NULL || opaque == NULL) { + if (opaque == NULL) { DLB2_LOG_ERR("NULL pointer"); return -EINVAL; } @@ -624,7 +624,7 @@ set_enable_cq_weight(const char *key __rte_unused, { bool *enable_cq_weight = opaque; - if (value == NULL || opaque == NULL) { + if (opaque == NULL) { DLB2_LOG_ERR("NULL pointer"); return -EINVAL; } @@ -645,7 +645,7 @@ set_qid_depth_thresh(const char *key __rte_unused, struct dlb2_qid_depth_thresholds *qid_thresh = opaque; int first, last, thresh, i; - if (value == NULL || opaque == NULL) { + if (opaque == NULL) { DLB2_LOG_ERR("NULL pointer"); return -EINVAL; } @@ -693,7 +693,7 @@ set_qid_depth_thresh_v2_5(const char *key __rte_unused, struct dlb2_qid_depth_thresholds *qid_thresh = opaque; int first, last, thresh, i; - if (value == NULL || opaque == NULL) { + if (opaque == NULL) { DLB2_LOG_ERR("NULL pointer"); return -EINVAL; } diff --git a/drivers/ml/cnxk/cn10k_ml_dev.c b/drivers/ml/cnxk/cn10k_ml_dev.c index c35895dc14..f50d097c72 100644 --- a/drivers/ml/cnxk/cn10k_ml_dev.c +++ b/drivers/ml/cnxk/cn10k_ml_dev.c @@ -69,7 +69,7 @@ struct cn10k_ml_error_db ml_etype_db[] = { static int parse_string_arg(const char *key __rte_unused, const char *value, void *extra_args) { - if (value == NULL || extra_args == NULL) + if (extra_args == NULL) return -EINVAL; *(char **)extra_args = strdup(value); diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index 1f7c0d77d5..1c7ad3f2f2 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -5901,7 +5901,7 @@ bnxt_parse_devarg_flow_xstat(__rte_unused const char *key, unsigned long flow_xstat; char *end = NULL; - if (!value || !opaque_arg) { + if (!opaque_arg) { PMD_DRV_LOG_LINE(ERR, "Invalid parameter passed to flow_xstat devarg."); return -EINVAL; @@ -5936,7 +5936,7 @@ bnxt_parse_devarg_max_num_kflows(__rte_unused const char *key, unsigned long max_num_kflows; char *end = NULL; - if (!value || !opaque_arg) { + if (!opaque_arg) { PMD_DRV_LOG_LINE(ERR, "Invalid parameter passed to max_num_kflows devarg."); return -EINVAL; @@ -5972,7 +5972,7 @@ bnxt_parse_devarg_cqe_mode(__rte_unused const char *key, unsigned long cqe_mode; char *end = NULL; - if (!value || !opaque_arg) { + if (!opaque_arg) { PMD_DRV_LOG_LINE(ERR, "Invalid parameter passed to cqe-mode " "devargs."); @@ -6009,7 +6009,7 @@ bnxt_parse_devarg_app_id(__rte_unused const char *key, unsigned long app_id; char *end = NULL; - if (!value || !opaque_arg) { + if (!opaque_arg) { PMD_DRV_LOG_LINE(ERR, "Invalid parameter passed to app-id " "devargs."); @@ -6045,7 +6045,7 @@ bnxt_parse_devarg_ieee_1588(__rte_unused const char *key, unsigned long ieee_1588; char *end = NULL; - if (!value || !opaque_arg) { + if (!opaque_arg) { PMD_DRV_LOG_LINE(ERR, "Invalid parameter passed to ieee-1588 " "devargs."); @@ -6081,7 +6081,7 @@ bnxt_parse_devarg_rep_is_pf(__rte_unused const char *key, unsigned long rep_is_pf; char *end = NULL; - if (!value || !opaque_arg) { + if (!opaque_arg) { PMD_DRV_LOG_LINE(ERR, "Invalid parameter passed to rep_is_pf devargs."); return -EINVAL; @@ -6118,7 +6118,7 @@ bnxt_parse_devarg_rep_based_pf(__rte_unused const char *key, unsigned long rep_based_pf; char *end = NULL; - if (!value || !opaque_arg) { + if (!opaque_arg) { PMD_DRV_LOG_LINE(ERR, "Invalid parameter passed to rep_based_pf " "devargs."); @@ -6156,7 +6156,7 @@ bnxt_parse_devarg_rep_q_r2f(__rte_unused const char *key, unsigned long rep_q_r2f; char *end = NULL; - if (!value || !opaque_arg) { + if (!opaque_arg) { PMD_DRV_LOG_LINE(ERR, "Invalid parameter passed to rep_q_r2f " "devargs."); @@ -6193,7 +6193,7 @@ bnxt_parse_devarg_rep_q_f2r(__rte_unused const char *key, unsigned long rep_q_f2r; char *end = NULL; - if (!value || !opaque_arg) { + if (!opaque_arg) { PMD_DRV_LOG_LINE(ERR, "Invalid parameter passed to rep_q_f2r " "devargs."); @@ -6230,7 +6230,7 @@ bnxt_parse_devarg_rep_fc_r2f(__rte_unused const char *key, unsigned long rep_fc_r2f; char *end = NULL; - if (!value || !opaque_arg) { + if (!opaque_arg) { PMD_DRV_LOG_LINE(ERR, "Invalid parameter passed to rep_fc_r2f " "devargs."); @@ -6267,7 +6267,7 @@ bnxt_parse_devarg_rep_fc_f2r(__rte_unused const char *key, unsigned long rep_fc_f2r; char *end = NULL; - if (!value || !opaque_arg) { + if (!opaque_arg) { PMD_DRV_LOG_LINE(ERR, "Invalid parameter passed to rep_fc_f2r " "devargs."); diff --git a/drivers/net/bonding/rte_eth_bond_args.c b/drivers/net/bonding/rte_eth_bond_args.c index bdec5d61d4..f334432fc7 100644 --- a/drivers/net/bonding/rte_eth_bond_args.c +++ b/drivers/net/bonding/rte_eth_bond_args.c @@ -114,7 +114,7 @@ bond_ethdev_parse_member_port_kvarg(const char *key, { struct bond_ethdev_member_ports *member_ports; - if (value == NULL || extra_args == NULL) + if (extra_args == NULL) return -1; member_ports = extra_args; @@ -139,7 +139,7 @@ bond_ethdev_parse_member_mode_kvarg(const char *key __rte_unused, uint8_t *mode; char *endptr; - if (value == NULL || extra_args == NULL) + if (extra_args == NULL) return -1; mode = extra_args; @@ -171,7 +171,7 @@ bond_ethdev_parse_member_agg_mode_kvarg(const char *key __rte_unused, { uint8_t *agg_mode; - if (value == NULL || extra_args == NULL) + if (extra_args == NULL) return -1; agg_mode = extra_args; @@ -204,7 +204,7 @@ bond_ethdev_parse_socket_id_kvarg(const char *key __rte_unused, long socket_id; char *endptr; - if (value == NULL || extra_args == NULL) + if (extra_args == NULL) return -1; errno = 0; @@ -232,7 +232,7 @@ bond_ethdev_parse_primary_member_port_id_kvarg(const char *key __rte_unused, { int primary_member_port_id; - if (value == NULL || extra_args == NULL) + if (extra_args == NULL) return -1; primary_member_port_id = parse_port_id(value); @@ -250,7 +250,7 @@ bond_ethdev_parse_balance_xmit_policy_kvarg(const char *key __rte_unused, { uint8_t *xmit_policy; - if (value == NULL || extra_args == NULL) + if (extra_args == NULL) return -1; xmit_policy = extra_args; @@ -271,7 +271,7 @@ int bond_ethdev_parse_bond_mac_addr_kvarg(const char *key __rte_unused, const char *value, void *extra_args) { - if (value == NULL || extra_args == NULL) + if (extra_args == NULL) return -1; /* Parse MAC */ @@ -285,7 +285,7 @@ bond_ethdev_parse_time_ms_kvarg(const char *key __rte_unused, uint32_t time_ms; char *endptr; - if (value == NULL || extra_args == NULL) + if (extra_args == NULL) return -1; errno = 0; diff --git a/drivers/net/failsafe/failsafe_args.c b/drivers/net/failsafe/failsafe_args.c index 1b8f1d3050..864a3b9eeb 100644 --- a/drivers/net/failsafe/failsafe_args.c +++ b/drivers/net/failsafe/failsafe_args.c @@ -352,7 +352,7 @@ fs_get_u64_arg(const char *key __rte_unused, uint64_t *u64 = out; char *endptr = NULL; - if ((value == NULL) || (out == NULL)) + if (out == NULL) return -EINVAL; errno = 0; *u64 = strtoull(value, &endptr, 0); @@ -369,7 +369,7 @@ fs_get_mac_addr_arg(const char *key __rte_unused, { struct rte_ether_addr *ea = out; - if ((value == NULL) || (out == NULL)) + if (out == NULL) return -EINVAL; return rte_ether_unformat_addr(value, ea); diff --git a/drivers/net/hns3/hns3_common.c b/drivers/net/hns3/hns3_common.c index 99a1d59a8a..24c4c675d6 100644 --- a/drivers/net/hns3/hns3_common.c +++ b/drivers/net/hns3/hns3_common.c @@ -169,7 +169,7 @@ hns3_parse_io_hint_func(const char *key, const char *value, void *extra_args) RTE_SET_USED(key); - if (value == NULL || extra_args == NULL) + if (extra_args == NULL) return 0; if (strcmp(value, "vec") == 0) @@ -212,7 +212,7 @@ hns3_parse_dev_caps_mask(const char *key, const char *value, void *extra_args) RTE_SET_USED(key); - if (value == NULL || extra_args == NULL) + if (extra_args == NULL) return 0; val = strtoull(value, NULL, HNS3_CONVERT_TO_HEXADECIMAL); @@ -228,7 +228,7 @@ hns3_parse_mbx_time_limit(const char *key, const char *value, void *extra_args) RTE_SET_USED(key); - if (value == NULL || extra_args == NULL) + if (extra_args == NULL) return 0; val = strtoul(value, NULL, HNS3_CONVERT_TO_DECIMAL); @@ -251,11 +251,6 @@ hns3_parse_vlan_match_mode(const char *key, const char *value, void *args) RTE_SET_USED(key); - if (value == NULL) { - PMD_INIT_LOG(WARNING, "no value for key:\"%s\"", key); - return -1; - } - if (strcmp(value, "strict") == 0) { mode = HNS3_FDIR_VLAN_STRICT_MATCH; } else if (strcmp(value, "nostrict") == 0) { diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c index 7f80cd6258..1e969bd8b8 100644 --- a/drivers/net/iavf/iavf_ethdev.c +++ b/drivers/net/iavf/iavf_ethdev.c @@ -2236,7 +2236,7 @@ iavf_handle_proto_xtr_arg(__rte_unused const char *key, const char *value, { struct iavf_devargs *devargs = extra_args; - if (!value || !extra_args) + if (!extra_args) return -EINVAL; if (iavf_parse_queue_proto_xtr(value, devargs) < 0) { diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index d5e94a6685..a3311f0f7a 100644 --- a/drivers/net/ice/ice_ethdev.c +++ b/drivers/net/ice/ice_ethdev.c @@ -646,7 +646,7 @@ handle_proto_xtr_arg(__rte_unused const char *key, const char *value, { struct ice_devargs *devargs = extra_args; - if (value == NULL || extra_args == NULL) + if (extra_args == NULL) return -EINVAL; if (parse_queue_proto_xtr(value, devargs) < 0) { @@ -665,7 +665,7 @@ handle_field_offs_arg(__rte_unused const char *key, const char *value, { uint8_t *offset = offs_args; - if (value == NULL || offs_args == NULL) + if (offs_args == NULL) return -EINVAL; if (!isdigit(*value)) @@ -2171,7 +2171,7 @@ handle_pps_out_arg(__rte_unused const char *key, const char *value, { struct ice_devargs *devargs = extra_args; - if (value == NULL || extra_args == NULL) + if (extra_args == NULL) return -EINVAL; if (parse_pps_out_parameter(value, devargs) < 0) { diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 7da2ccf6a8..1e292b1f9d 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -1555,7 +1555,7 @@ devarg_handle_int(__rte_unused const char *key, const char *value, { uint16_t *n = extra_args; - if (value == NULL || extra_args == NULL) + if (extra_args == NULL) return -EINVAL; *n = (uint16_t)strtoul(value, NULL, 0); diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c index ed91507fbc..72e0894820 100644 --- a/drivers/net/nfp/nfp_ethdev.c +++ b/drivers/net/nfp/nfp_ethdev.c @@ -56,9 +56,6 @@ nfp_devarg_handle_int(const char *key, char *end_ptr; uint64_t *num = extra_args; - if (value == NULL) - return -EPERM; - *num = strtoul(value, &end_ptr, 10); if (*num == ULONG_MAX) { PMD_DRV_LOG(ERR, "%s: '%s' is not a valid param.", key, value); diff --git a/drivers/net/ntnic/ntutil/nt_util.c b/drivers/net/ntnic/ntutil/nt_util.c index 694ab7a3b3..b5d7cb47f4 100644 --- a/drivers/net/ntnic/ntutil/nt_util.c +++ b/drivers/net/ntnic/ntutil/nt_util.c @@ -237,7 +237,7 @@ int nt_link_duplex_to_eth_duplex(enum nt_link_duplex_e nt_link_duplex) int string_to_u32(const char *key_str __rte_unused, const char *value_str, void *extra_args) { - if (!value_str || !extra_args) + if (!extra_args) return -1; const uint32_t value = strtol(value_str, NULL, 0); diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c index 6764cf2ec1..633dfaa84f 100644 --- a/drivers/net/null/rte_eth_null.c +++ b/drivers/net/null/rte_eth_null.c @@ -613,7 +613,7 @@ get_packet_size_arg(const char *key __rte_unused, const char *a = value; unsigned int *packet_size = extra_args; - if ((value == NULL) || (extra_args == NULL)) + if (extra_args == NULL) return -EINVAL; *packet_size = (unsigned int)strtoul(a, NULL, 0); @@ -630,7 +630,7 @@ get_packet_copy_arg(const char *key __rte_unused, const char *a = value; unsigned int *packet_copy = extra_args; - if ((value == NULL) || (extra_args == NULL)) + if (extra_args == NULL) return -EINVAL; *packet_copy = (unsigned int)strtoul(a, NULL, 0); @@ -647,7 +647,7 @@ get_packet_no_rx_arg(const char *key __rte_unused, const char *a = value; unsigned int no_rx; - if (value == NULL || extra_args == NULL) + if (extra_args == NULL) return -EINVAL; no_rx = (unsigned int)strtoul(a, NULL, 0); diff --git a/drivers/net/softnic/rte_eth_softnic.c b/drivers/net/softnic/rte_eth_softnic.c index 2147ea35f6..835c3745ba 100644 --- a/drivers/net/softnic/rte_eth_softnic.c +++ b/drivers/net/softnic/rte_eth_softnic.c @@ -333,7 +333,7 @@ pmd_ethdev_register(struct rte_vdev_device *vdev, static int get_string(const char *key __rte_unused, const char *value, void *extra_args) { - if (!value || !extra_args) + if (!extra_args) return -EINVAL; *(char **)extra_args = strdup(value); @@ -347,7 +347,7 @@ get_string(const char *key __rte_unused, const char *value, void *extra_args) static int get_uint32(const char *key __rte_unused, const char *value, void *extra_args) { - if (!value || !extra_args) + if (!extra_args) return -EINVAL; *(uint32_t *)extra_args = strtoull(value, NULL, 0); @@ -358,7 +358,7 @@ get_uint32(const char *key __rte_unused, const char *value, void *extra_args) static int get_uint16(const char *key __rte_unused, const char *value, void *extra_args) { - if (!value || !extra_args) + if (!extra_args) return -EINVAL; *(uint16_t *)extra_args = strtoull(value, NULL, 0); diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c index 36b06b3ac5..9366cb39b8 100644 --- a/drivers/net/tap/rte_eth_tap.c +++ b/drivers/net/tap/rte_eth_tap.c @@ -2484,19 +2484,19 @@ rte_pmd_tap_probe(struct rte_vdev_device *dev) } if (rte_kvargs_count(kvlist, ETH_TAP_REMOTE_ARG) == 1) { - ret = rte_kvargs_process(kvlist, - ETH_TAP_REMOTE_ARG, - &set_remote_iface, - remote_iface); + ret = rte_kvargs_process_opt(kvlist, + ETH_TAP_REMOTE_ARG, + &set_remote_iface, + remote_iface); if (ret == -1) goto leave; } if (rte_kvargs_count(kvlist, ETH_TAP_MAC_ARG) == 1) { - ret = rte_kvargs_process(kvlist, - ETH_TAP_MAC_ARG, - &set_mac_type, - &user_mac); + ret = rte_kvargs_process_opt(kvlist, + ETH_TAP_MAC_ARG, + &set_mac_type, + &user_mac); if (ret == -1) goto leave; } diff --git a/drivers/net/txgbe/txgbe_ethdev.c b/drivers/net/txgbe/txgbe_ethdev.c index 2834468764..47fb8423ba 100644 --- a/drivers/net/txgbe/txgbe_ethdev.c +++ b/drivers/net/txgbe/txgbe_ethdev.c @@ -484,7 +484,7 @@ txgbe_handle_devarg(__rte_unused const char *key, const char *value, { uint16_t *n = extra_args; - if (value == NULL || extra_args == NULL) + if (extra_args == NULL) return -EINVAL; *n = (uint16_t)strtoul(value, NULL, 10); diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c index 87c05caccd..2fc53cede1 100644 --- a/drivers/net/vhost/rte_eth_vhost.c +++ b/drivers/net/vhost/rte_eth_vhost.c @@ -1572,9 +1572,6 @@ open_iface(const char *key __rte_unused, const char *value, void *extra_args) { const char **iface_name = extra_args; - if (value == NULL) - return -1; - *iface_name = value; return 0; @@ -1585,7 +1582,7 @@ open_int(const char *key __rte_unused, const char *value, void *extra_args) { uint16_t *n = extra_args; - if (value == NULL || extra_args == NULL) + if (extra_args == NULL) return -EINVAL; *n = (uint16_t)strtoul(value, NULL, 0); diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index 70d4839def..fabf367c5f 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -2034,7 +2034,7 @@ virtio_dev_speed_capa_get(uint32_t speed) static int vectorized_check_handler(__rte_unused const char *key, const char *value, void *ret_val) { - if (value == NULL || ret_val == NULL) + if (ret_val == NULL) return -EINVAL; if (strcmp(value, "1") == 0) @@ -2053,7 +2053,7 @@ link_speed_handler(const char *key __rte_unused, const char *value, void *ret_val) { uint32_t val; - if (!value || !ret_val) + if (!ret_val) return -EINVAL; val = strtoul(value, NULL, 0); /* validate input */ diff --git a/drivers/net/virtio/virtio_pci_ethdev.c b/drivers/net/virtio/virtio_pci_ethdev.c index 9b4b846f8a..62aa6addc9 100644 --- a/drivers/net/virtio/virtio_pci_ethdev.c +++ b/drivers/net/virtio/virtio_pci_ethdev.c @@ -148,7 +148,7 @@ eth_virtio_pci_uninit(struct rte_eth_dev *eth_dev) static int vdpa_check_handler(__rte_unused const char *key, const char *value, void *ret_val) { - if (value == NULL || ret_val == NULL) + if (ret_val == NULL) return -EINVAL; if (strcmp(value, "1") == 0) diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c index 747dddeb2e..bb44c41d77 100644 --- a/drivers/net/virtio/virtio_user_ethdev.c +++ b/drivers/net/virtio/virtio_user_ethdev.c @@ -376,7 +376,7 @@ static int get_string_arg(const char *key __rte_unused, const char *value, void *extra_args) { - if (!value || !extra_args) + if (!extra_args) return -EINVAL; *(char **)extra_args = strdup(value); @@ -392,7 +392,7 @@ get_integer_arg(const char *key __rte_unused, const char *value, void *extra_args) { uint64_t integer = 0; - if (!value || !extra_args) + if (!extra_args) return -EINVAL; errno = 0; integer = strtoull(value, NULL, 0); diff --git a/drivers/raw/ifpga/ifpga_rawdev.c b/drivers/raw/ifpga/ifpga_rawdev.c index 5b9b596435..6c77b2945e 100644 --- a/drivers/raw/ifpga/ifpga_rawdev.c +++ b/drivers/raw/ifpga/ifpga_rawdev.c @@ -1706,7 +1706,7 @@ static int ifpga_rawdev_get_string_arg(const char *key __rte_unused, const char *value, void *extra_args) { int size; - if (!value || !extra_args) + if (!extra_args) return -EINVAL; size = strlen(value) + 1; diff --git a/drivers/raw/skeleton/skeleton_rawdev.c b/drivers/raw/skeleton/skeleton_rawdev.c index 6e99d35536..86c544c6b5 100644 --- a/drivers/raw/skeleton/skeleton_rawdev.c +++ b/drivers/raw/skeleton/skeleton_rawdev.c @@ -664,7 +664,7 @@ skeldev_get_selftest(const char *key __rte_unused, void *opaque) { int *flag = opaque; - if (value == NULL || opaque == NULL) + if (opaque == NULL) return -EINVAL; *flag = atoi(value); return 0; diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c b/drivers/vdpa/ifc/ifcvf_vdpa.c index 65de383b95..23079a15a4 100644 --- a/drivers/vdpa/ifc/ifcvf_vdpa.c +++ b/drivers/vdpa/ifc/ifcvf_vdpa.c @@ -1483,7 +1483,7 @@ open_int(const char *key __rte_unused, const char *value, void *extra_args) { uint16_t *n = extra_args; - if (value == NULL || extra_args == NULL) + if (extra_args == NULL) return -EINVAL; *n = (uint16_t)strtoul(value, NULL, 0); diff --git a/drivers/vdpa/sfc/sfc_vdpa_filter.c b/drivers/vdpa/sfc/sfc_vdpa_filter.c index 73cc396cb0..ed66acb173 100644 --- a/drivers/vdpa/sfc/sfc_vdpa_filter.c +++ b/drivers/vdpa/sfc/sfc_vdpa_filter.c @@ -16,7 +16,7 @@ sfc_vdpa_get_eth_addr(const char *key __rte_unused, { struct rte_ether_addr *mac_addr = extra_args; - if (value == NULL || extra_args == NULL) + if (extra_args == NULL) return -EINVAL; /* Convert string with Ethernet address to an ether_addr */ diff --git a/lib/compressdev/rte_compressdev_pmd.c b/lib/compressdev/rte_compressdev_pmd.c index 762b44f03e..1f3236b3aa 100644 --- a/lib/compressdev/rte_compressdev_pmd.c +++ b/lib/compressdev/rte_compressdev_pmd.c @@ -23,7 +23,7 @@ rte_compressdev_pmd_parse_name_arg(const char *key __rte_unused, struct rte_compressdev_pmd_init_params *params = extra_args; int n; - if (value == NULL || extra_args == NULL) + if (extra_args == NULL) return -EINVAL; n = strlcpy(params->name, value, RTE_COMPRESSDEV_NAME_MAX_LEN); @@ -43,7 +43,7 @@ rte_compressdev_pmd_parse_uint_arg(const char *key __rte_unused, int i; char *end; - if (value == NULL || extra_args == NULL) + if (extra_args == NULL) return -EINVAL; errno = 0; diff --git a/lib/cryptodev/cryptodev_pmd.c b/lib/cryptodev/cryptodev_pmd.c index 87ced122b4..49228fc26d 100644 --- a/lib/cryptodev/cryptodev_pmd.c +++ b/lib/cryptodev/cryptodev_pmd.c @@ -22,7 +22,7 @@ rte_cryptodev_pmd_parse_name_arg(const char *key __rte_unused, struct rte_cryptodev_pmd_init_params *params = extra_args; int n; - if (value == NULL || extra_args == NULL) + if (extra_args == NULL) return -EINVAL; n = strlcpy(params->name, value, RTE_CRYPTODEV_NAME_MAX_LEN); @@ -42,7 +42,7 @@ rte_cryptodev_pmd_parse_uint_arg(const char *key __rte_unused, int i; char *end; - if (value == NULL || extra_args == NULL) + if (extra_args == NULL) return -EINVAL; errno = 0; diff --git a/lib/ethdev/rte_ethdev_telemetry.c b/lib/ethdev/rte_ethdev_telemetry.c index 5e6c4172d3..b728232011 100644 --- a/lib/ethdev/rte_ethdev_telemetry.c +++ b/lib/ethdev/rte_ethdev_telemetry.c @@ -79,9 +79,6 @@ eth_dev_parse_hide_zero(const char *key, const char *value, void *extra_args) { RTE_SET_USED(key); - if (value == NULL) - return -1; - if (strcmp(value, "true") == 0) *(bool *)extra_args = true; else if (strcmp(value, "false") == 0) -- 2.17.1