diff options
author | Guofeng Yue <yueguofeng@hisilicon.com> | 2022-09-07 14:28:10 +0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2022-09-16 10:27:47 +0100 |
commit | b0b815a356aa4f3352563b3350a7b2354c0f2c5c (patch) | |
tree | ad8aca9339484b68bfdd66c280d04de293a488e5 /drivers/net/ethernet/amd/pcnet32.c | |
parent | 454e7b138436a31a17753de58f2178c3e955886c (diff) | |
download | lwn-b0b815a356aa4f3352563b3350a7b2354c0f2c5c.tar.gz lwn-b0b815a356aa4f3352563b3350a7b2354c0f2c5c.zip |
net: amd: Unified the comparison between pointers and NULL to the same writing
Using the unified way to compare pointers and NULL, which cleans the static
warning.
eg:
if (skb == NULL) --> if (!skb)
if (skb != NULL) --> if (skb)
Signed-off-by: Guofeng Yue <yueguofeng@hisilicon.com>
Signed-off-by: Haoyue Xu <xuhaoyue1@hisilicon.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/amd/pcnet32.c')
-rw-r--r-- | drivers/net/ethernet/amd/pcnet32.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/net/ethernet/amd/pcnet32.c b/drivers/net/ethernet/amd/pcnet32.c index c9138175ec07..72db9f9e7bee 100644 --- a/drivers/net/ethernet/amd/pcnet32.c +++ b/drivers/net/ethernet/amd/pcnet32.c @@ -488,7 +488,7 @@ static void pcnet32_realloc_tx_ring(struct net_device *dev, dma_alloc_coherent(&lp->pci_dev->dev, sizeof(struct pcnet32_tx_head) * entries, &new_ring_dma_addr, GFP_ATOMIC); - if (new_tx_ring == NULL) + if (!new_tx_ring) return; new_dma_addr_list = kcalloc(entries, sizeof(dma_addr_t), GFP_ATOMIC); @@ -547,7 +547,7 @@ static void pcnet32_realloc_rx_ring(struct net_device *dev, dma_alloc_coherent(&lp->pci_dev->dev, sizeof(struct pcnet32_rx_head) * entries, &new_ring_dma_addr, GFP_ATOMIC); - if (new_rx_ring == NULL) + if (!new_rx_ring) return; new_dma_addr_list = kcalloc(entries, sizeof(dma_addr_t), GFP_ATOMIC); @@ -1249,7 +1249,7 @@ static void pcnet32_rx_entry(struct net_device *dev, } else skb = netdev_alloc_skb(dev, pkt_len + NET_IP_ALIGN); - if (skb == NULL) { + if (!skb) { dev->stats.rx_dropped++; return; } @@ -2018,7 +2018,7 @@ static int pcnet32_alloc_ring(struct net_device *dev, const char *name) lp->tx_ring = dma_alloc_coherent(&lp->pci_dev->dev, sizeof(struct pcnet32_tx_head) * lp->tx_ring_size, &lp->tx_ring_dma_addr, GFP_KERNEL); - if (lp->tx_ring == NULL) { + if (!lp->tx_ring) { netif_err(lp, drv, dev, "Coherent memory allocation failed\n"); return -ENOMEM; } @@ -2026,7 +2026,7 @@ static int pcnet32_alloc_ring(struct net_device *dev, const char *name) lp->rx_ring = dma_alloc_coherent(&lp->pci_dev->dev, sizeof(struct pcnet32_rx_head) * lp->rx_ring_size, &lp->rx_ring_dma_addr, GFP_KERNEL); - if (lp->rx_ring == NULL) { + if (!lp->rx_ring) { netif_err(lp, drv, dev, "Coherent memory allocation failed\n"); return -ENOMEM; } @@ -2365,7 +2365,7 @@ static int pcnet32_init_ring(struct net_device *dev) for (i = 0; i < lp->rx_ring_size; i++) { struct sk_buff *rx_skbuff = lp->rx_skbuff[i]; - if (rx_skbuff == NULL) { + if (!rx_skbuff) { lp->rx_skbuff[i] = netdev_alloc_skb(dev, PKT_BUF_SKB); rx_skbuff = lp->rx_skbuff[i]; if (!rx_skbuff) { |