[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1500980794-92499-2-git-send-email-xiangxia.m.yue@gmail.com>
Date: Tue, 25 Jul 2017 04:06:33 -0700
From: Tonghao Zhang <xiangxia.m.yue@...il.com>
To: netdev@...r.kernel.org
Cc: Tonghao Zhang <xiangxia.m.yue@...il.com>
Subject: [PATCH 2/3] drivers/net: Compare pointer-typed values to NULL rather than 0.
This makes an effort to choose between !x and x == NULL.
1. drivers/net/ethernet/nxp/lpc_eth.c
2. drivers/net/ethernet/amd/declance.c
Generated by: scripts/coccinelle/null/badzero.cocci
Signed-off-by: Tonghao Zhang <xiangxia.m.yue@...il.com>
---
drivers/net/ethernet/amd/declance.c | 2 +-
drivers/net/ethernet/nxp/lpc_eth.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/amd/declance.c b/drivers/net/ethernet/amd/declance.c
index 82cc813..76e623b 100644
--- a/drivers/net/ethernet/amd/declance.c
+++ b/drivers/net/ethernet/amd/declance.c
@@ -606,7 +606,7 @@ static int lance_rx(struct net_device *dev)
len = (*rds_ptr(rd, mblength, lp->type) & 0xfff) - 4;
skb = netdev_alloc_skb(dev, len + 2);
- if (skb == 0) {
+ if (!skb) {
dev->stats.rx_dropped++;
*rds_ptr(rd, mblength, lp->type) = 0;
*rds_ptr(rd, rmd1, lp->type) =
diff --git a/drivers/net/ethernet/nxp/lpc_eth.c b/drivers/net/ethernet/nxp/lpc_eth.c
index 08381ef..0d177d4 100644
--- a/drivers/net/ethernet/nxp/lpc_eth.c
+++ b/drivers/net/ethernet/nxp/lpc_eth.c
@@ -1338,7 +1338,7 @@ static int lpc_eth_drv_probe(struct platform_device *pdev)
/* Get size of DMA buffers/descriptors region */
pldat->dma_buff_size = (ENET_TX_DESC + ENET_RX_DESC) * (ENET_MAXF_SIZE +
sizeof(struct txrx_desc_t) + sizeof(struct rx_status_t));
- pldat->dma_buff_base_v = 0;
+ pldat->dma_buff_base_v = NULL;
if (use_iram_for_net(&pldat->pdev->dev)) {
dma_handle = LPC32XX_IRAM_BASE;
@@ -1350,7 +1350,7 @@ static int lpc_eth_drv_probe(struct platform_device *pdev)
"IRAM not big enough for net buffers, using SDRAM instead.\n");
}
- if (pldat->dma_buff_base_v == 0) {
+ if (pldat->dma_buff_base_v == NULL) {
ret = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
if (ret)
goto err_out_free_irq;
--
1.8.3.1
Powered by blists - more mailing lists