From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-gw2-out.broadcom.com (mail-gw2-out.broadcom.com [216.31.210.63]) by dpdk.org (Postfix) with ESMTP id 62D565AB9 for ; Fri, 6 May 2016 21:27:10 +0200 (CEST) X-IronPort-AV: E=Sophos;i="5.24,587,1455004800"; d="scan'208";a="94860669" Received: from mail-irv-18.broadcom.com ([10.15.198.37]) by mail-gw2-out.broadcom.com with ESMTP; 06 May 2016 12:41:06 -0700 Received: from mail-irva-12.broadcom.com (mail-irva-12.broadcom.com [10.11.16.101]) by mail-irv-18.broadcom.com (Postfix) with ESMTP id DE56F82023 for ; Fri, 6 May 2016 12:26:56 -0700 (PDT) Received: from DPDK-C1.broadcom.com (dhcp-10-13-115-104.irv.broadcom.com [10.13.115.104]) by mail-irva-12.broadcom.com (Postfix) with ESMTP id 84D3012762E for ; Fri, 6 May 2016 12:26:53 -0700 (PDT) From: Stephen Hurd To: dev@dpdk.org Date: Fri, 6 May 2016 12:26:20 -0700 Message-Id: <1462562780-47991-40-git-send-email-stephen.hurd@broadcom.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1462562780-47991-1-git-send-email-stephen.hurd@broadcom.com> References: <20160421100005.GA976@bricha3-MOBL3> <1462562780-47991-1-git-send-email-stephen.hurd@broadcom.com> Subject: [dpdk-dev] [PATCH 40/40] bnxt: cleanup null pointer checks X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 May 2016 19:27:10 -0000 Prefer !ptr to ptr == NULL Signed-off-by: Stephen Hurd Reviewed-by: Ajit Kumar Khaparde --- drivers/net/bnxt/bnxt_ethdev.c | 10 +++++----- drivers/net/bnxt/bnxt_filter.c | 2 +- drivers/net/bnxt/bnxt_hwrm.c | 6 +++--- drivers/net/bnxt/bnxt_ring.c | 2 +- drivers/net/bnxt/bnxt_vnic.c | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index 93dac7a..2f1a85a 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -535,7 +535,7 @@ static void bnxt_promiscuous_enable_op(struct rte_eth_dev *eth_dev) struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private; struct bnxt_vnic_info *vnic; - if (bp->vnic_info == NULL) + if (!bp->vnic_info) return; vnic = &bp->vnic_info[0]; @@ -549,7 +549,7 @@ static void bnxt_promiscuous_disable_op(struct rte_eth_dev *eth_dev) struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private; struct bnxt_vnic_info *vnic; - if (bp->vnic_info == NULL) + if (!bp->vnic_info) return; vnic = &bp->vnic_info[0]; @@ -563,7 +563,7 @@ static void bnxt_allmulticast_enable_op(struct rte_eth_dev *eth_dev) struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private; struct bnxt_vnic_info *vnic; - if (bp->vnic_info == NULL) + if (!bp->vnic_info) return; vnic = &bp->vnic_info[0]; @@ -577,7 +577,7 @@ static void bnxt_allmulticast_disable_op(struct rte_eth_dev *eth_dev) struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private; struct bnxt_vnic_info *vnic; - if (bp->vnic_info == NULL) + if (!bp->vnic_info) return; vnic = &bp->vnic_info[0]; @@ -955,7 +955,7 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev) } eth_dev->data->mac_addrs = rte_zmalloc("bnxt_mac_addr_tbl", ETHER_ADDR_LEN * MAX_NUM_MAC_ADDR, 0); - if (eth_dev->data->mac_addrs == NULL) { + if (!eth_dev->data->mac_addrs) { RTE_LOG(ERR, PMD, "Failed to alloc %u bytes needed to store MAC addr tbl", ETHER_ADDR_LEN * MAX_NUM_MAC_ADDR); diff --git a/drivers/net/bnxt/bnxt_filter.c b/drivers/net/bnxt/bnxt_filter.c index f03a1dc..d2576f7 100644 --- a/drivers/net/bnxt/bnxt_filter.c +++ b/drivers/net/bnxt/bnxt_filter.c @@ -165,7 +165,7 @@ int bnxt_alloc_filter_mem(struct bnxt *bp) filter_mem = rte_zmalloc("bnxt_filter_info", max_filters * sizeof(struct bnxt_filter_info), 0); - if (filter_mem == NULL) { + if (!filter_mem) { RTE_LOG(ERR, PMD, "Failed to alloc memory for %d filters", max_filters); return -ENOMEM; diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c index 1a1f108..8994c47 100644 --- a/drivers/net/bnxt/bnxt_hwrm.c +++ b/drivers/net/bnxt/bnxt_hwrm.c @@ -431,7 +431,7 @@ int bnxt_hwrm_ver_get(struct bnxt *bp) rte_free(bp->hwrm_cmd_resp_addr); bp->hwrm_cmd_resp_addr = rte_malloc(type, max_resp_len, 0); - if (bp->hwrm_cmd_resp_addr == NULL) { + if (!bp->hwrm_cmd_resp_addr) { rc = -ENOMEM; goto error; } @@ -1171,7 +1171,7 @@ int bnxt_alloc_hwrm_resources(struct bnxt *bp) bp->max_req_len = HWRM_MAX_REQ_LEN; bp->max_resp_len = HWRM_MAX_RESP_LEN; bp->hwrm_cmd_resp_addr = rte_malloc(type, bp->max_resp_len, 0); - if (bp->hwrm_cmd_resp_addr == NULL) + if (!bp->hwrm_cmd_resp_addr) return -ENOMEM; bp->hwrm_cmd_resp_dma_addr = rte_malloc_virt2phy(bp->hwrm_cmd_resp_addr); @@ -1211,7 +1211,7 @@ void bnxt_free_all_hwrm_resources(struct bnxt *bp) struct bnxt_vnic_info *vnic; unsigned i; - if (bp->vnic_info == NULL) + if (!bp->vnic_info) return; vnic = &bp->vnic_info[0]; diff --git a/drivers/net/bnxt/bnxt_ring.c b/drivers/net/bnxt/bnxt_ring.c index 8852e28..91f6371 100644 --- a/drivers/net/bnxt/bnxt_ring.c +++ b/drivers/net/bnxt/bnxt_ring.c @@ -143,7 +143,7 @@ int bnxt_alloc_rings(struct bnxt *bp, uint16_t qidx, SOCKET_ID_ANY, RTE_MEMZONE_2MB | RTE_MEMZONE_SIZE_HINT_ONLY); - if (mz == NULL) + if (!mz) return -ENOMEM; } memset(mz->addr, 0, mz->len); diff --git a/drivers/net/bnxt/bnxt_vnic.c b/drivers/net/bnxt/bnxt_vnic.c index c04c4c7..e957c0d 100644 --- a/drivers/net/bnxt/bnxt_vnic.c +++ b/drivers/net/bnxt/bnxt_vnic.c @@ -267,7 +267,7 @@ int bnxt_alloc_vnic_mem(struct bnxt *bp) /* Allocate memory for VNIC pool and filter pool */ vnic_mem = rte_zmalloc("bnxt_vnic_info", max_vnics * sizeof(struct bnxt_vnic_info), 0); - if (vnic_mem == NULL) { + if (!vnic_mem) { RTE_LOG(ERR, PMD, "Failed to alloc memory for %d VNICs", max_vnics); return -ENOMEM; -- 1.9.1