[3/3] net/nfp: explicitly compare to null and 0

Message ID 20230206070549.27265-4-chaoyong.he@corigine.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series cleanup the PMD |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/github-robot: build success github build: passed
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-abi-testing success Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS

Commit Message

Chaoyong He Feb. 6, 2023, 7:05 a.m. UTC
  From: James Hershaw <james.hershaw@corigine.com>

Removal of the '!' character when comparing variables in favour of
explicitly comparing the variable to either 'NULL' or '0', in
compliance with the standard.

Signed-off-by: James Hershaw <james.hershaw@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
 drivers/net/nfp/nfp_common.c               | 24 +++++++++----------
 drivers/net/nfp/nfp_cpp_bridge.c           |  4 ++--
 drivers/net/nfp/nfp_ethdev.c               |  2 +-
 drivers/net/nfp/nfp_ethdev_vf.c            |  2 +-
 drivers/net/nfp/nfp_rxtx.c                 | 14 +++++------
 drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c | 16 ++++++-------
 drivers/net/nfp/nfpcore/nfp_cppcore.c      | 28 +++++++++++-----------
 drivers/net/nfp/nfpcore/nfp_hwinfo.c       |  6 ++---
 drivers/net/nfp/nfpcore/nfp_mip.c          |  4 ++--
 drivers/net/nfp/nfpcore/nfp_mutex.c        |  4 ++--
 drivers/net/nfp/nfpcore/nfp_nffw.c         | 10 ++++----
 drivers/net/nfp/nfpcore/nfp_nsp.c          |  6 ++---
 drivers/net/nfp/nfpcore/nfp_nsp_cmds.c     |  6 ++---
 drivers/net/nfp/nfpcore/nfp_nsp_eth.c      | 22 ++++++++---------
 drivers/net/nfp/nfpcore/nfp_resource.c     |  8 +++----
 drivers/net/nfp/nfpcore/nfp_rtsym.c        | 24 +++++++++----------
 drivers/net/nfp/nfpcore/nfp_target.h       |  2 +-
 17 files changed, 91 insertions(+), 91 deletions(-)
  

Patch

diff --git a/drivers/net/nfp/nfp_common.c b/drivers/net/nfp/nfp_common.c
index f97264e9f0..c9401055d4 100644
--- a/drivers/net/nfp/nfp_common.c
+++ b/drivers/net/nfp/nfp_common.c
@@ -470,7 +470,7 @@  nfp_net_promisc_enable(struct rte_eth_dev *dev)
 		hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	}
 
-	if (!(hw->cap & NFP_NET_CFG_CTRL_PROMISC)) {
+	if ((hw->cap & NFP_NET_CFG_CTRL_PROMISC) == 0) {
 		PMD_INIT_LOG(INFO, "Promiscuous mode not supported");
 		return -ENOTSUP;
 	}
@@ -1088,7 +1088,7 @@  nfp_net_dev_interrupt_handler(void *param)
 	nfp_net_link_update(dev, 0);
 
 	/* likely to up */
-	if (!link.link_status) {
+	if (link.link_status == 0) {
 		/* handle it 1 sec later, wait it being stable */
 		timeout = NFP_NET_LINK_UP_CHECK_TIMEOUT;
 		/* likely to down */
@@ -1173,7 +1173,7 @@  nfp_net_vlan_offload_set(struct rte_eth_dev *dev, int mask)
 	update = NFP_NET_CFG_UPDATE_GEN;
 
 	ret = nfp_net_reconfig(hw, new_ctrl, update);
-	if (!ret)
+	if (ret == 0)
 		hw->ctrl = new_ctrl;
 
 	return ret;
@@ -1207,7 +1207,7 @@  nfp_net_rss_reta_write(struct rte_eth_dev *dev,
 		shift = i % RTE_ETH_RETA_GROUP_SIZE;
 		mask = (uint8_t)((reta_conf[idx].mask >> shift) & 0xF);
 
-		if (!mask)
+		if (mask == 0)
 			continue;
 
 		reta = 0;
@@ -1216,7 +1216,7 @@  nfp_net_rss_reta_write(struct rte_eth_dev *dev,
 			reta = nn_cfg_readl(hw, NFP_NET_CFG_RSS_ITBL + i);
 
 		for (j = 0; j < 4; j++) {
-			if (!(mask & (0x1 << j)))
+			if ((mask & (0x1 << j)) == 0)
 				continue;
 			if (mask != 0xF)
 				/* Clearing the entry bits */
@@ -1240,7 +1240,7 @@  nfp_net_reta_update(struct rte_eth_dev *dev,
 	uint32_t update;
 	int ret;
 
-	if (!(hw->ctrl & NFP_NET_CFG_CTRL_RSS_ANY))
+	if ((hw->ctrl & NFP_NET_CFG_CTRL_RSS_ANY) == 0)
 		return -EINVAL;
 
 	ret = nfp_net_rss_reta_write(dev, reta_conf, reta_size);
@@ -1268,7 +1268,7 @@  nfp_net_reta_query(struct rte_eth_dev *dev,
 
 	hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
-	if (!(hw->ctrl & NFP_NET_CFG_CTRL_RSS_ANY))
+	if ((hw->ctrl & NFP_NET_CFG_CTRL_RSS_ANY) == 0)
 		return -EINVAL;
 
 	if (reta_size != NFP_NET_CFG_RSS_ITBL_SZ) {
@@ -1288,13 +1288,13 @@  nfp_net_reta_query(struct rte_eth_dev *dev,
 		shift = i % RTE_ETH_RETA_GROUP_SIZE;
 		mask = (uint8_t)((reta_conf[idx].mask >> shift) & 0xF);
 
-		if (!mask)
+		if (mask == 0)
 			continue;
 
 		reta = nn_cfg_readl(hw, NFP_NET_CFG_RSS_ITBL + (idx * 64) +
 				    shift);
 		for (j = 0; j < 4; j++) {
-			if (!(mask & (0x1 << j)))
+			if ((mask & (0x1 << j)) == 0)
 				continue;
 			reta_conf[idx].reta[shift + j] =
 				(uint8_t)((reta >> (8 * j)) & 0xF);
@@ -1366,7 +1366,7 @@  nfp_net_rss_hash_update(struct rte_eth_dev *dev,
 	rss_hf = rss_conf->rss_hf;
 
 	/* Checking if RSS is enabled */
-	if (!(hw->ctrl & NFP_NET_CFG_CTRL_RSS_ANY)) {
+	if ((hw->ctrl & NFP_NET_CFG_CTRL_RSS_ANY) == 0) {
 		if (rss_hf != 0) { /* Enable RSS? */
 			PMD_DRV_LOG(ERR, "RSS unsupported");
 			return -EINVAL;
@@ -1401,7 +1401,7 @@  nfp_net_rss_hash_conf_get(struct rte_eth_dev *dev,
 
 	hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
-	if (!(hw->ctrl & NFP_NET_CFG_CTRL_RSS_ANY))
+	if ((hw->ctrl & NFP_NET_CFG_CTRL_RSS_ANY) == 0)
 		return -EINVAL;
 
 	rss_hf = rss_conf->rss_hf;
@@ -1469,7 +1469,7 @@  nfp_net_rss_config_default(struct rte_eth_dev *dev)
 		return ret;
 
 	dev_conf = &dev->data->dev_conf;
-	if (!dev_conf) {
+	if (dev_conf == NULL) {
 		PMD_DRV_LOG(INFO, "wrong rss conf");
 		return -EINVAL;
 	}
diff --git a/drivers/net/nfp/nfp_cpp_bridge.c b/drivers/net/nfp/nfp_cpp_bridge.c
index e650fe9930..4aa36eb581 100644
--- a/drivers/net/nfp/nfp_cpp_bridge.c
+++ b/drivers/net/nfp/nfp_cpp_bridge.c
@@ -161,7 +161,7 @@  nfp_cpp_bridge_serve_write(int sockfd, struct nfp_cpp *cpp)
 		/* configure a CPP PCIe2CPP BAR for mapping the CPP target */
 		area = nfp_cpp_area_alloc_with_name(cpp, cpp_id, "nfp.cdev",
 						    nfp_offset, curlen);
-		if (!area) {
+		if (area == NULL) {
 			RTE_LOG(ERR, PMD, "%s: area alloc fail\n", __func__);
 			return -EIO;
 		}
@@ -261,7 +261,7 @@  nfp_cpp_bridge_serve_read(int sockfd, struct nfp_cpp *cpp)
 	while (count > 0) {
 		area = nfp_cpp_area_alloc_with_name(cpp, cpp_id, "nfp.cdev",
 						    nfp_offset, curlen);
-		if (!area) {
+		if (area == NULL) {
 			RTE_LOG(ERR, PMD, "%s: area alloc failed\n", __func__);
 			return -EIO;
 		}
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index 31201c0197..f05c50ac88 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -652,7 +652,7 @@  nfp_net_init(struct rte_eth_dev *eth_dev)
 	rte_ether_addr_copy((struct rte_ether_addr *)hw->mac_addr,
 			&eth_dev->data->mac_addrs[0]);
 
-	if (!(hw->cap & NFP_NET_CFG_CTRL_LIVE_ADDR))
+	if ((hw->cap & NFP_NET_CFG_CTRL_LIVE_ADDR) == 0)
 		eth_dev->data->dev_flags |= RTE_ETH_DEV_NOLIVE_MAC_ADDR;
 
 	eth_dev->data->dev_flags |= RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS;
diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c
index 4eea197f85..07a2e17ef8 100644
--- a/drivers/net/nfp/nfp_ethdev_vf.c
+++ b/drivers/net/nfp/nfp_ethdev_vf.c
@@ -417,7 +417,7 @@  nfp_netvf_init(struct rte_eth_dev *eth_dev)
 	rte_ether_addr_copy((struct rte_ether_addr *)hw->mac_addr,
 			&eth_dev->data->mac_addrs[0]);
 
-	if (!(hw->cap & NFP_NET_CFG_CTRL_LIVE_ADDR))
+	if ((hw->cap & NFP_NET_CFG_CTRL_LIVE_ADDR) == 0)
 		eth_dev->data->dev_flags |= RTE_ETH_DEV_NOLIVE_MAC_ADDR;
 
 	eth_dev->data->dev_flags |= RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS;
diff --git a/drivers/net/nfp/nfp_rxtx.c b/drivers/net/nfp/nfp_rxtx.c
index a5907cc428..79a66b6e44 100644
--- a/drivers/net/nfp/nfp_rxtx.c
+++ b/drivers/net/nfp/nfp_rxtx.c
@@ -186,7 +186,7 @@  nfp_net_parse_meta_hash(const struct nfp_meta_parsed *meta,
 		hash = meta->hash;
 		hash_type = meta->hash_type;
 	} else {
-		if (!(rxd->rxd.flags & PCIE_DESC_RX_RSS))
+		if ((rxd->rxd.flags & PCIE_DESC_RX_RSS) == 0)
 			return;
 
 		hash = rte_be_to_cpu_32(*(uint32_t *)NFP_HASH_OFFSET);
@@ -1045,7 +1045,7 @@  nfp_net_nfd3_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pk
 			 * Making the EOP, packets with just one segment
 			 * the priority
 			 */
-			if (likely(!pkt_size))
+			if (likely(pkt_size == 0))
 				txds->offset_eop = PCIE_DESC_TX_EOP;
 			else
 				txds->offset_eop = 0;
@@ -1360,7 +1360,7 @@  nfp_net_nfdk_tx_cksum(struct nfp_net_txq *txq, struct rte_mbuf *mb,
 	uint64_t ol_flags;
 	struct nfp_net_hw *hw = txq->hw;
 
-	if (!(hw->cap & NFP_NET_CFG_CTRL_TXCSUM))
+	if ((hw->cap & NFP_NET_CFG_CTRL_TXCSUM) == 0)
 		return flags;
 
 	ol_flags = mb->ol_flags;
@@ -1382,12 +1382,12 @@  nfp_net_nfdk_tx_tso(struct nfp_net_txq *txq, struct rte_mbuf *mb)
 	struct nfp_net_nfdk_tx_desc txd;
 	struct nfp_net_hw *hw = txq->hw;
 
-	if (!(hw->cap & NFP_NET_CFG_CTRL_LSO_ANY))
+	if ((hw->cap & NFP_NET_CFG_CTRL_LSO_ANY) == 0)
 		goto clean_txd;
 
 	ol_flags = mb->ol_flags;
 
-	if (!(ol_flags & RTE_MBUF_F_TX_TCP_SEG))
+	if ((ol_flags & RTE_MBUF_F_TX_TCP_SEG) == 0)
 		goto clean_txd;
 
 	txd.l3_offset = mb->l2_len;
@@ -1476,7 +1476,7 @@  nfp_net_nfdk_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pk
 		if ((hw->cap & NFP_NET_CFG_CTRL_LSO_ANY) &&
 				(pkt->ol_flags & RTE_MBUF_F_TX_TCP_SEG)) {
 			type = NFDK_DESC_TX_TYPE_TSO;
-		} else if (!pkt->next && dma_len < NFDK_TX_MAX_DATA_PER_HEAD) {
+		} else if (pkt->next == NULL && dma_len < NFDK_TX_MAX_DATA_PER_HEAD) {
 			type = NFDK_DESC_TX_TYPE_SIMPLE;
 		} else {
 			type = NFDK_DESC_TX_TYPE_GATHER;
@@ -1532,7 +1532,7 @@  nfp_net_nfdk_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pk
 				dma_addr += dlen_type + 1;
 			}
 
-			if (!pkt->next)
+			if (pkt->next == NULL)
 				break;
 
 			pkt = pkt->next;
diff --git a/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c b/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c
index e818fcc8e8..d8d1293166 100644
--- a/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c
+++ b/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c
@@ -242,7 +242,7 @@  nfp_bar_write(struct nfp_pcie_user *nfp, struct nfp_bar *bar,
 	base = bar->index >> 3;
 	slot = bar->index & 7;
 
-	if (!nfp->cfg)
+	if (nfp->cfg == NULL)
 		return (-ENOMEM);
 
 	bar->csr = nfp->cfg +
@@ -342,7 +342,7 @@  nfp_alloc_bar(struct nfp_pcie_user *nfp)
 	}
 	for (x = start; x > end; x--) {
 		bar = &nfp->bar[x - 1];
-		if (!bar->lock) {
+		if (bar->lock == 0) {
 			bar->lock = 1;
 			return bar;
 		}
@@ -459,7 +459,7 @@  nfp6000_area_acquire(struct nfp_cpp_area *area)
 	}
 
 	/* Must have been too big. Sub-allocate. */
-	if (!priv->bar->iomem)
+	if (priv->bar->iomem == NULL)
 		return (-ENOMEM);
 
 	priv->iomem = priv->bar->iomem + priv->bar_offset;
@@ -472,7 +472,7 @@  nfp6000_area_mapped(struct nfp_cpp_area *area)
 {
 	struct nfp6000_area_priv *area_priv = nfp_cpp_area_priv(area);
 
-	if (!area_priv->iomem)
+	if (area_priv->iomem == NULL)
 		return NULL;
 
 	return area_priv->iomem;
@@ -543,7 +543,7 @@  nfp6000_area_read(struct nfp_cpp_area *area, void *kernel_vaddr,
 			return -EINVAL;
 	}
 
-	if (!priv->bar)
+	if (priv->bar == NULL)
 		return -EFAULT;
 
 	if (is_64)
@@ -608,7 +608,7 @@  nfp6000_area_write(struct nfp_cpp_area *area, const void *kernel_vaddr,
 			return -EINVAL;
 	}
 
-	if (!priv->bar)
+	if (priv->bar == NULL)
 		return -EFAULT;
 
 	if (is_64)
@@ -680,7 +680,7 @@  nfp_acquire_secondary_process_lock(struct nfp_pcie_user *desc)
 	lockfile = calloc(strlen(home_path) + strlen(lockname) + 1,
 			  sizeof(char));
 
-	if (!lockfile)
+	if (lockfile == NULL)
 		return -ENOMEM;
 
 	strcat(lockfile, home_path);
@@ -805,7 +805,7 @@  nfp6000_init(struct nfp_cpp *cpp, struct rte_pci_device *dev)
 	struct nfp_pcie_user *desc;
 
 	desc = malloc(sizeof(*desc));
-	if (!desc)
+	if (desc == NULL)
 		return -1;
 
 
diff --git a/drivers/net/nfp/nfpcore/nfp_cppcore.c b/drivers/net/nfp/nfpcore/nfp_cppcore.c
index e1e0a143f9..72f50ace38 100644
--- a/drivers/net/nfp/nfpcore/nfp_cppcore.c
+++ b/drivers/net/nfp/nfpcore/nfp_cppcore.c
@@ -51,7 +51,7 @@  nfp_cpp_model(struct nfp_cpp *cpp)
 	int err;
 	uint32_t model;
 
-	if (!cpp)
+	if (cpp == NULL)
 		return NFP_CPP_MODEL_INVALID;
 
 	err = __nfp_cpp_model_autodetect(cpp, &model);
@@ -83,7 +83,7 @@  nfp_cpp_serial_set(struct nfp_cpp *cpp, const uint8_t *serial,
 		free(cpp->serial);
 
 	cpp->serial = malloc(serial_len);
-	if (!cpp->serial)
+	if (cpp->serial == NULL)
 		return -1;
 
 	memcpy(cpp->serial, serial, serial_len);
@@ -95,7 +95,7 @@  nfp_cpp_serial_set(struct nfp_cpp *cpp, const uint8_t *serial,
 uint16_t
 nfp_cpp_interface(struct nfp_cpp *cpp)
 {
-	if (!cpp)
+	if (cpp == NULL)
 		return NFP_CPP_INTERFACE(NFP_CPP_INTERFACE_TYPE_INVALID, 0, 0);
 
 	return cpp->interface;
@@ -140,7 +140,7 @@  nfp_cpp_area_alloc_with_name(struct nfp_cpp *cpp, uint32_t dest,
 	uint64_t tmp64 = (uint64_t)address;
 	int tmp, err;
 
-	if (!cpp)
+	if (cpp == NULL)
 		return NULL;
 
 	/* CPP bus uses only a 40-bit address */
@@ -154,12 +154,12 @@  nfp_cpp_area_alloc_with_name(struct nfp_cpp *cpp, uint32_t dest,
 
 	address = (unsigned long long)tmp64;
 
-	if (!name)
+	if (name == NULL)
 		name = "";
 
 	area = calloc(1, sizeof(*area) + cpp->op->area_priv_size +
 		      strlen(name) + 1);
-	if (!area)
+	if (area == NULL)
 		return NULL;
 
 	area->cpp = cpp;
@@ -217,7 +217,7 @@  nfp_cpp_area_alloc_acquire(struct nfp_cpp *cpp, uint32_t destination,
 	struct nfp_cpp_area *area;
 
 	area = nfp_cpp_area_alloc(cpp, destination, address, size);
-	if (!area)
+	if (area == NULL)
 		return NULL;
 
 	if (nfp_cpp_area_acquire(area)) {
@@ -404,7 +404,7 @@  nfp_xpb_to_cpp(struct nfp_cpp *cpp, uint32_t *xpb_addr)
 	 */
 	island = ((*xpb_addr) >> 24) & 0x3f;
 
-	if (!island)
+	if (island == 0)
 		return xpb;
 
 	if (island == 1) {
@@ -555,11 +555,11 @@  nfp_cpp_alloc(struct rte_pci_device *dev, int driver_lock_needed)
 
 	ops = nfp_cpp_transport_operations();
 
-	if (!ops || !ops->init)
+	if (ops == NULL || ops->init == NULL)
 		return NFP_ERRPTR(EINVAL);
 
 	cpp = calloc(1, sizeof(*cpp));
-	if (!cpp)
+	if (cpp == NULL)
 		return NULL;
 
 	cpp->op = ops;
@@ -701,7 +701,7 @@  nfp_cpp_read(struct nfp_cpp *cpp, uint32_t destination,
 	int err;
 
 	area = nfp_cpp_area_alloc_acquire(cpp, destination, address, length);
-	if (!area) {
+	if (area == NULL) {
 		PMD_DRV_LOG(ERR, "Area allocation/acquire failed");
 		return -1;
 	}
@@ -729,7 +729,7 @@  nfp_cpp_write(struct nfp_cpp *cpp, uint32_t destination,
 	int err;
 
 	area = nfp_cpp_area_alloc_acquire(cpp, destination, address, length);
-	if (!area)
+	if (area == NULL)
 		return -1;
 
 	err = nfp_cpp_area_write(area, 0, kernel_vaddr, length);
@@ -841,11 +841,11 @@  nfp_cpp_map_area(struct nfp_cpp *cpp, int domain, int target, uint64_t addr,
 	dest = NFP_CPP_ISLAND_ID(target, NFP_CPP_ACTION_RW, 0, domain);
 
 	*area = nfp_cpp_area_alloc_acquire(cpp, dest, addr, size);
-	if (!*area)
+	if (*area == NULL)
 		goto err_eio;
 
 	res = nfp_cpp_area_iomem(*area);
-	if (!res)
+	if (res == NULL)
 		goto err_release_free;
 
 	return res;
diff --git a/drivers/net/nfp/nfpcore/nfp_hwinfo.c b/drivers/net/nfp/nfpcore/nfp_hwinfo.c
index 9b66569953..9054bb0315 100644
--- a/drivers/net/nfp/nfpcore/nfp_hwinfo.c
+++ b/drivers/net/nfp/nfpcore/nfp_hwinfo.c
@@ -101,7 +101,7 @@  nfp_hwinfo_try_fetch(struct nfp_cpp *cpp, size_t *cpp_size)
 	}
 
 	db = malloc(*cpp_size + 1);
-	if (!db)
+	if (db == NULL)
 		return NULL;
 
 	err = nfp_cpp_read(cpp, cpp_id, cpp_addr, db, *cpp_size);
@@ -160,7 +160,7 @@  nfp_hwinfo_read(struct nfp_cpp *cpp)
 	int err;
 
 	db = nfp_hwinfo_fetch(cpp, &hwdb_size);
-	if (!db)
+	if (db == NULL)
 		return NULL;
 
 	err = nfp_hwinfo_db_validate(db, hwdb_size);
@@ -183,7 +183,7 @@  nfp_hwinfo_lookup(struct nfp_hwinfo *hwinfo, const char *lookup)
 {
 	const char *key, *val, *end;
 
-	if (!hwinfo || !lookup)
+	if (hwinfo == NULL || lookup == NULL)
 		return NULL;
 
 	end = hwinfo->data + hwinfo->size - sizeof(uint32_t);
diff --git a/drivers/net/nfp/nfpcore/nfp_mip.c b/drivers/net/nfp/nfpcore/nfp_mip.c
index d342bc4141..6b392ad5eb 100644
--- a/drivers/net/nfp/nfpcore/nfp_mip.c
+++ b/drivers/net/nfp/nfpcore/nfp_mip.c
@@ -71,7 +71,7 @@  nfp_mip_read_resource(struct nfp_cpp *cpp, struct nfp_mip *mip)
 	int err;
 
 	nffw_info = nfp_nffw_info_open(cpp);
-	if (!nffw_info)
+	if (nffw_info == NULL)
 		return -ENODEV;
 
 	err = nfp_nffw_info_mip_first(nffw_info, &cpp_id, &addr);
@@ -101,7 +101,7 @@  nfp_mip_open(struct nfp_cpp *cpp)
 	int err;
 
 	mip = malloc(sizeof(*mip));
-	if (!mip)
+	if (mip == NULL)
 		return NULL;
 
 	err = nfp_mip_read_resource(cpp, mip);
diff --git a/drivers/net/nfp/nfpcore/nfp_mutex.c b/drivers/net/nfp/nfpcore/nfp_mutex.c
index de9049c6a0..8a4e6a462a 100644
--- a/drivers/net/nfp/nfpcore/nfp_mutex.c
+++ b/drivers/net/nfp/nfpcore/nfp_mutex.c
@@ -153,7 +153,7 @@  nfp_cpp_mutex_alloc(struct nfp_cpp *cpp, int target,
 		return NFP_ERRPTR(EEXIST);
 
 	mutex = calloc(sizeof(*mutex), 1);
-	if (!mutex)
+	if (mutex == NULL)
 		return NFP_ERRPTR(ENOMEM);
 
 	mutex->cpp = cpp;
@@ -205,7 +205,7 @@  nfp_cpp_mutex_owner(struct nfp_cpp_mutex *mutex)
 	if (key != mutex->key)
 		return NFP_ERRNO(EPERM);
 
-	if (!MUTEX_IS_LOCKED(value))
+	if (MUTEX_IS_LOCKED(value) == 0)
 		return 0;
 
 	return MUTEX_INTERFACE(value);
diff --git a/drivers/net/nfp/nfpcore/nfp_nffw.c b/drivers/net/nfp/nfpcore/nfp_nffw.c
index 8bec0e3c9a..1382c4f6bf 100644
--- a/drivers/net/nfp/nfpcore/nfp_nffw.c
+++ b/drivers/net/nfp/nfpcore/nfp_nffw.c
@@ -123,13 +123,13 @@  nfp_nffw_info_open(struct nfp_cpp *cpp)
 	int err;
 
 	state = malloc(sizeof(*state));
-	if (!state)
+	if (state == NULL)
 		return NULL;
 
 	memset(state, 0, sizeof(*state));
 
 	state->res = nfp_resource_acquire(cpp, NFP_RESOURCE_NFP_NFFW);
-	if (!state->res)
+	if (state->res == NULL)
 		goto err_free;
 
 	fwinf = &state->fwinf;
@@ -143,7 +143,7 @@  nfp_nffw_info_open(struct nfp_cpp *cpp)
 	if (err < (int)sizeof(*fwinf))
 		goto err_release;
 
-	if (!nffw_res_flg_init_get(fwinf))
+	if (nffw_res_flg_init_get(fwinf) == 0)
 		goto err_release;
 
 	info_ver = nffw_res_info_version_get(fwinf);
@@ -186,7 +186,7 @@  nfp_nffw_info_fwid_first(struct nfp_nffw_info *state)
 	unsigned int cnt, i;
 
 	cnt = nffw_res_fwinfos(&state->fwinf, &fwinfo);
-	if (!cnt)
+	if (cnt == 0)
 		return NULL;
 
 	for (i = 0; i < cnt; i++)
@@ -211,7 +211,7 @@  nfp_nffw_info_mip_first(struct nfp_nffw_info *state, uint32_t *cpp_id,
 	struct nffw_fwinfo *fwinfo;
 
 	fwinfo = nfp_nffw_info_fwid_first(state);
-	if (!fwinfo)
+	if (fwinfo == NULL)
 		return -EINVAL;
 
 	*cpp_id = nffw_fwinfo_mip_cppid_get(fwinfo);
diff --git a/drivers/net/nfp/nfpcore/nfp_nsp.c b/drivers/net/nfp/nfpcore/nfp_nsp.c
index 22fb3407c6..d8abaf1d52 100644
--- a/drivers/net/nfp/nfpcore/nfp_nsp.c
+++ b/drivers/net/nfp/nfpcore/nfp_nsp.c
@@ -58,7 +58,7 @@  nfp_nsp_print_extended_error(uint32_t ret_val)
 {
 	int i;
 
-	if (!ret_val)
+	if (ret_val == 0)
 		return;
 
 	for (i = 0; i < (int)ARRAY_SIZE(nsp_errors); i++)
@@ -115,11 +115,11 @@  nfp_nsp_open(struct nfp_cpp *cpp)
 	int err;
 
 	res = nfp_resource_acquire(cpp, NFP_RESOURCE_NSP);
-	if (!res)
+	if (res == NULL)
 		return NULL;
 
 	state = malloc(sizeof(*state));
-	if (!state) {
+	if (state == NULL) {
 		nfp_resource_release(res);
 		return NULL;
 	}
diff --git a/drivers/net/nfp/nfpcore/nfp_nsp_cmds.c b/drivers/net/nfp/nfpcore/nfp_nsp_cmds.c
index 1de3d1b00f..15f6f7002d 100644
--- a/drivers/net/nfp/nfpcore/nfp_nsp_cmds.c
+++ b/drivers/net/nfp/nfpcore/nfp_nsp_cmds.c
@@ -34,7 +34,7 @@  __nfp_nsp_identify(struct nfp_nsp *nsp)
 		return NULL;
 
 	ni = malloc(sizeof(*ni));
-	if (!ni)
+	if (ni == NULL)
 		return NULL;
 
 	memset(ni, 0, sizeof(*ni));
@@ -45,7 +45,7 @@  __nfp_nsp_identify(struct nfp_nsp *nsp)
 	}
 
 	nspi = malloc(sizeof(*nspi));
-	if (!nspi)
+	if (nspi == NULL)
 		goto exit_free;
 
 	memset(nspi, 0, sizeof(*nspi));
@@ -80,7 +80,7 @@  nfp_hwmon_read_sensor(struct nfp_cpp *cpp, enum nfp_nsp_sensor_id id, long *val)
 	int ret;
 
 	nsp = nfp_nsp_open(cpp);
-	if (!nsp)
+	if (nsp == NULL)
 		return -EIO;
 
 	ret = nfp_nsp_read_sensors(nsp, BIT(id), &s, sizeof(s));
diff --git a/drivers/net/nfp/nfpcore/nfp_nsp_eth.c b/drivers/net/nfp/nfpcore/nfp_nsp_eth.c
index eb532e5f3a..578120636d 100644
--- a/drivers/net/nfp/nfpcore/nfp_nsp_eth.c
+++ b/drivers/net/nfp/nfpcore/nfp_nsp_eth.c
@@ -270,7 +270,7 @@  __nfp_eth_read_ports(struct nfp_nsp *nsp)
 	const struct rte_ether_addr *mac;
 
 	entries = malloc(NSP_ETH_TABLE_SIZE);
-	if (!entries)
+	if (entries == NULL)
 		return NULL;
 
 	memset(entries, 0, NSP_ETH_TABLE_SIZE);
@@ -286,7 +286,7 @@  __nfp_eth_read_ports(struct nfp_nsp *nsp)
 	for (i = 0; i < NSP_ETH_MAX_COUNT; i++) {
 		mac = (const struct rte_ether_addr *)entries[i].mac_addr;
 		if ((entries[i].port & NSP_ETH_PORT_LANES_MASK) &&
-				(!rte_is_zero_ether_addr(mac)))
+				!rte_is_zero_ether_addr(mac))
 			cnt++;
 	}
 
@@ -302,7 +302,7 @@  __nfp_eth_read_ports(struct nfp_nsp *nsp)
 
 	table_sz = sizeof(*table) + sizeof(struct nfp_eth_table_port) * cnt;
 	table = malloc(table_sz);
-	if (!table)
+	if (table == NULL)
 		goto err;
 
 	memset(table, 0, table_sz);
@@ -310,7 +310,7 @@  __nfp_eth_read_ports(struct nfp_nsp *nsp)
 	for (i = 0, j = 0; i < NSP_ETH_MAX_COUNT; i++) {
 		mac = (const struct rte_ether_addr *)entries[i].mac_addr;
 		if ((entries[i].port & NSP_ETH_PORT_LANES_MASK) &&
-				(!rte_is_zero_ether_addr(mac)))
+				!rte_is_zero_ether_addr(mac))
 			nfp_eth_port_translate(nsp, &entries[i], i,
 					&table->ports[j++]);
 	}
@@ -344,7 +344,7 @@  nfp_eth_read_ports(struct nfp_cpp *cpp)
 	struct nfp_nsp *nsp;
 
 	nsp = nfp_nsp_open(cpp);
-	if (!nsp)
+	if (nsp == NULL)
 		return NULL;
 
 	ret = __nfp_eth_read_ports(nsp);
@@ -361,12 +361,12 @@  nfp_eth_config_start(struct nfp_cpp *cpp, unsigned int idx)
 	int ret;
 
 	entries = malloc(NSP_ETH_TABLE_SIZE);
-	if (!entries)
+	if (entries == NULL)
 		return NULL;
 
 	memset(entries, 0, NSP_ETH_TABLE_SIZE);
 	nsp = nfp_nsp_open(cpp);
-	if (!nsp) {
+	if (nsp == NULL) {
 		free(entries);
 		return nsp;
 	}
@@ -377,7 +377,7 @@  nfp_eth_config_start(struct nfp_cpp *cpp, unsigned int idx)
 		goto err;
 	}
 
-	if (!(entries[idx].port & NSP_ETH_PORT_LANES_MASK)) {
+	if ((entries[idx].port & NSP_ETH_PORT_LANES_MASK) == 0) {
 		PMD_DRV_LOG(ERR, "trying to set port state on disabled port %d", idx);
 		goto err;
 	}
@@ -454,7 +454,7 @@  nfp_eth_set_mod_enable(struct nfp_cpp *cpp, unsigned int idx, int enable)
 	uint64_t reg;
 
 	nsp = nfp_eth_config_start(cpp, idx);
-	if (!nsp)
+	if (nsp == NULL)
 		return -1;
 
 	entries = nfp_nsp_config_entries(nsp);
@@ -494,7 +494,7 @@  nfp_eth_set_configured(struct nfp_cpp *cpp, unsigned int idx, int configed)
 	uint64_t reg;
 
 	nsp = nfp_eth_config_start(cpp, idx);
-	if (!nsp)
+	if (nsp == NULL)
 		return -EIO;
 
 	/*
@@ -617,7 +617,7 @@  nfp_eth_set_fec(struct nfp_cpp *cpp, unsigned int idx, enum nfp_eth_fec mode)
 	int err;
 
 	nsp = nfp_eth_config_start(cpp, idx);
-	if (!nsp)
+	if (nsp == NULL)
 		return -EIO;
 
 	err = __nfp_eth_set_fec(nsp, mode);
diff --git a/drivers/net/nfp/nfpcore/nfp_resource.c b/drivers/net/nfp/nfpcore/nfp_resource.c
index fda03a6576..892ccf73c4 100644
--- a/drivers/net/nfp/nfpcore/nfp_resource.c
+++ b/drivers/net/nfp/nfpcore/nfp_resource.c
@@ -77,7 +77,7 @@  nfp_cpp_resource_find(struct nfp_cpp *cpp, struct nfp_resource *res)
 	strlcpy(name_pad, res->name, sizeof(name_pad));
 
 	/* Search for a matching entry */
-	if (!memcmp(name_pad, NFP_RESOURCE_TBL_NAME "\0\0\0\0\0\0\0\0", 8)) {
+	if (memcmp(name_pad, NFP_RESOURCE_TBL_NAME "\0\0\0\0\0\0\0\0", 8) == 0) {
 		PMD_DRV_LOG(ERR, "Grabbing device lock not supported");
 		return -EOPNOTSUPP;
 	}
@@ -157,7 +157,7 @@  nfp_resource_acquire(struct nfp_cpp *cpp, const char *name)
 	int count;
 
 	res = malloc(sizeof(*res));
-	if (!res)
+	if (res == NULL)
 		return NULL;
 
 	memset(res, 0, sizeof(*res));
@@ -167,7 +167,7 @@  nfp_resource_acquire(struct nfp_cpp *cpp, const char *name)
 	dev_mutex = nfp_cpp_mutex_alloc(cpp, NFP_RESOURCE_TBL_TARGET,
 					NFP_RESOURCE_TBL_BASE,
 					NFP_RESOURCE_TBL_KEY);
-	if (!dev_mutex) {
+	if (dev_mutex == NULL) {
 		free(res);
 		return NULL;
 	}
@@ -178,7 +178,7 @@  nfp_resource_acquire(struct nfp_cpp *cpp, const char *name)
 
 	for (;;) {
 		err = nfp_resource_try_acquire(cpp, res, dev_mutex);
-		if (!err)
+		if (err == 0)
 			break;
 		if (err != -EBUSY)
 			goto err_free;
diff --git a/drivers/net/nfp/nfpcore/nfp_rtsym.c b/drivers/net/nfp/nfpcore/nfp_rtsym.c
index 288a37da60..850667adf8 100644
--- a/drivers/net/nfp/nfpcore/nfp_rtsym.c
+++ b/drivers/net/nfp/nfpcore/nfp_rtsym.c
@@ -103,13 +103,13 @@  __nfp_rtsym_table_read(struct nfp_cpp *cpp, const struct nfp_mip *mip)
 		NFP_ISL_EMEM0;
 	int err, n, size;
 
-	if (!mip)
+	if (mip == NULL)
 		return NULL;
 
 	nfp_mip_strtab(mip, &strtab_addr, &strtab_size);
 	nfp_mip_symtab(mip, &symtab_addr, &symtab_size);
 
-	if (!symtab_size || !strtab_size || symtab_size % sizeof(*rtsymtab))
+	if (symtab_size == 0 || strtab_size == 0 || symtab_size % sizeof(*rtsymtab) != 0)
 		return NULL;
 
 	/* Align to 64 bits */
@@ -117,14 +117,14 @@  __nfp_rtsym_table_read(struct nfp_cpp *cpp, const struct nfp_mip *mip)
 	strtab_size = round_up(strtab_size, 8);
 
 	rtsymtab = malloc(symtab_size);
-	if (!rtsymtab)
+	if (rtsymtab == NULL)
 		return NULL;
 
 	size = sizeof(*cache);
 	size += symtab_size / sizeof(*rtsymtab) * sizeof(struct nfp_rtsym);
 	size +=	strtab_size + 1;
 	cache = malloc(size);
-	if (!cache)
+	if (cache == NULL)
 		goto exit_free_rtsym_raw;
 
 	cache->cpp = cpp;
@@ -164,7 +164,7 @@  __nfp_rtsym_table_read(struct nfp_cpp *cpp, const struct nfp_mip *mip)
 int
 nfp_rtsym_count(struct nfp_rtsym_table *rtbl)
 {
-	if (!rtbl)
+	if (rtbl == NULL)
 		return -EINVAL;
 
 	return rtbl->num;
@@ -180,7 +180,7 @@  nfp_rtsym_count(struct nfp_rtsym_table *rtbl)
 const struct nfp_rtsym *
 nfp_rtsym_get(struct nfp_rtsym_table *rtbl, int idx)
 {
-	if (!rtbl)
+	if (rtbl == NULL)
 		return NULL;
 
 	if (idx >= rtbl->num)
@@ -201,7 +201,7 @@  nfp_rtsym_lookup(struct nfp_rtsym_table *rtbl, const char *name)
 {
 	int n;
 
-	if (!rtbl)
+	if (rtbl == NULL)
 		return NULL;
 
 	for (n = 0; n < rtbl->num; n++)
@@ -232,7 +232,7 @@  nfp_rtsym_read_le(struct nfp_rtsym_table *rtbl, const char *name, int *error)
 	int err;
 
 	sym = nfp_rtsym_lookup(rtbl, name);
-	if (!sym) {
+	if (sym == NULL) {
 		err = -ENOENT;
 		goto exit;
 	}
@@ -277,8 +277,8 @@  nfp_rtsym_map(struct nfp_rtsym_table *rtbl, const char *name,
 
 	PMD_DRV_LOG(DEBUG, "mapping symbol %s", name);
 	sym = nfp_rtsym_lookup(rtbl, name);
-	if (!sym) {
-		PMD_DRV_LOG(ERR, "symbol lookup fails for %s", name);
+	if (sym == NULL) {
+		PMD_INIT_LOG(ERR, "symbol lookup fails for %s", name);
 		return NULL;
 	}
 
@@ -290,8 +290,8 @@  nfp_rtsym_map(struct nfp_rtsym_table *rtbl, const char *name,
 
 	mem = nfp_cpp_map_area(rtbl->cpp, sym->domain, sym->target, sym->addr,
 			       sym->size, area);
-	if (!mem) {
-		PMD_DRV_LOG(ERR, "Failed to map symbol %s", name);
+	if (mem == NULL) {
+		PMD_INIT_LOG(ERR, "Failed to map symbol %s", name);
 		return NULL;
 	}
 	PMD_DRV_LOG(DEBUG, "symbol %s with address %p", name, mem);
diff --git a/drivers/net/nfp/nfpcore/nfp_target.h b/drivers/net/nfp/nfpcore/nfp_target.h
index e8dcc9ad1e..d1e5a50b14 100644
--- a/drivers/net/nfp/nfpcore/nfp_target.h
+++ b/drivers/net/nfp/nfpcore/nfp_target.h
@@ -554,7 +554,7 @@  nfp_target_cpp(uint32_t cpp_island_id, uint64_t cpp_island_address,
 		return 0;
 	}
 
-	if (!imb_table) {
+	if (imb_table == NULL) {
 		/* CPP + Island only allowed on systems with IMB tables */
 		return NFP_ERRNO(EINVAL);
 	}