Merge branch 'bnx2-warnings'

Varsha Rao says:

====================
net: bnx2: Fix checkpatch and clang warnings

This patchset fixes NULL comparison and extra parentheses, checkpatch
and clang warnings.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
David S. Miller 2018-06-04 17:07:28 -04:00
commit 7a9ee41b83
1 changed files with 22 additions and 22 deletions

View File

@ -384,7 +384,7 @@ static int bnx2_register_cnic(struct net_device *dev, struct cnic_ops *ops,
struct bnx2 *bp = netdev_priv(dev); struct bnx2 *bp = netdev_priv(dev);
struct cnic_eth_dev *cp = &bp->cnic_eth_dev; struct cnic_eth_dev *cp = &bp->cnic_eth_dev;
if (ops == NULL) if (!ops)
return -EINVAL; return -EINVAL;
if (cp->drv_state & CNIC_DRV_STATE_REGD) if (cp->drv_state & CNIC_DRV_STATE_REGD)
@ -755,13 +755,13 @@ bnx2_alloc_tx_mem(struct bnx2 *bp)
struct bnx2_tx_ring_info *txr = &bnapi->tx_ring; struct bnx2_tx_ring_info *txr = &bnapi->tx_ring;
txr->tx_buf_ring = kzalloc(SW_TXBD_RING_SIZE, GFP_KERNEL); txr->tx_buf_ring = kzalloc(SW_TXBD_RING_SIZE, GFP_KERNEL);
if (txr->tx_buf_ring == NULL) if (!txr->tx_buf_ring)
return -ENOMEM; return -ENOMEM;
txr->tx_desc_ring = txr->tx_desc_ring =
dma_alloc_coherent(&bp->pdev->dev, TXBD_RING_SIZE, dma_alloc_coherent(&bp->pdev->dev, TXBD_RING_SIZE,
&txr->tx_desc_mapping, GFP_KERNEL); &txr->tx_desc_mapping, GFP_KERNEL);
if (txr->tx_desc_ring == NULL) if (!txr->tx_desc_ring)
return -ENOMEM; return -ENOMEM;
} }
return 0; return 0;
@ -779,7 +779,7 @@ bnx2_alloc_rx_mem(struct bnx2 *bp)
rxr->rx_buf_ring = rxr->rx_buf_ring =
vzalloc(SW_RXBD_RING_SIZE * bp->rx_max_ring); vzalloc(SW_RXBD_RING_SIZE * bp->rx_max_ring);
if (rxr->rx_buf_ring == NULL) if (!rxr->rx_buf_ring)
return -ENOMEM; return -ENOMEM;
for (j = 0; j < bp->rx_max_ring; j++) { for (j = 0; j < bp->rx_max_ring; j++) {
@ -788,7 +788,7 @@ bnx2_alloc_rx_mem(struct bnx2 *bp)
RXBD_RING_SIZE, RXBD_RING_SIZE,
&rxr->rx_desc_mapping[j], &rxr->rx_desc_mapping[j],
GFP_KERNEL); GFP_KERNEL);
if (rxr->rx_desc_ring[j] == NULL) if (!rxr->rx_desc_ring[j])
return -ENOMEM; return -ENOMEM;
} }
@ -796,7 +796,7 @@ bnx2_alloc_rx_mem(struct bnx2 *bp)
if (bp->rx_pg_ring_size) { if (bp->rx_pg_ring_size) {
rxr->rx_pg_ring = vzalloc(SW_RXPG_RING_SIZE * rxr->rx_pg_ring = vzalloc(SW_RXPG_RING_SIZE *
bp->rx_max_pg_ring); bp->rx_max_pg_ring);
if (rxr->rx_pg_ring == NULL) if (!rxr->rx_pg_ring)
return -ENOMEM; return -ENOMEM;
} }
@ -807,7 +807,7 @@ bnx2_alloc_rx_mem(struct bnx2 *bp)
RXBD_RING_SIZE, RXBD_RING_SIZE,
&rxr->rx_pg_desc_mapping[j], &rxr->rx_pg_desc_mapping[j],
GFP_KERNEL); GFP_KERNEL);
if (rxr->rx_pg_desc_ring[j] == NULL) if (!rxr->rx_pg_desc_ring[j])
return -ENOMEM; return -ENOMEM;
} }
@ -845,7 +845,7 @@ bnx2_alloc_stats_blk(struct net_device *dev)
sizeof(struct statistics_block); sizeof(struct statistics_block);
status_blk = dma_zalloc_coherent(&bp->pdev->dev, bp->status_stats_size, status_blk = dma_zalloc_coherent(&bp->pdev->dev, bp->status_stats_size,
&bp->status_blk_mapping, GFP_KERNEL); &bp->status_blk_mapping, GFP_KERNEL);
if (status_blk == NULL) if (!status_blk)
return -ENOMEM; return -ENOMEM;
bp->status_blk = status_blk; bp->status_blk = status_blk;
@ -914,7 +914,7 @@ bnx2_alloc_mem(struct bnx2 *bp)
BNX2_PAGE_SIZE, BNX2_PAGE_SIZE,
&bp->ctx_blk_mapping[i], &bp->ctx_blk_mapping[i],
GFP_KERNEL); GFP_KERNEL);
if (bp->ctx_blk[i] == NULL) if (!bp->ctx_blk[i])
goto alloc_mem_err; goto alloc_mem_err;
} }
} }
@ -2667,7 +2667,7 @@ bnx2_alloc_bad_rbuf(struct bnx2 *bp)
u32 val; u32 val;
good_mbuf = kmalloc(512 * sizeof(u16), GFP_KERNEL); good_mbuf = kmalloc(512 * sizeof(u16), GFP_KERNEL);
if (good_mbuf == NULL) if (!good_mbuf)
return -ENOMEM; return -ENOMEM;
BNX2_WR(bp, BNX2_MISC_ENABLE_SET_BITS, BNX2_WR(bp, BNX2_MISC_ENABLE_SET_BITS,
@ -3225,7 +3225,7 @@ bnx2_rx_int(struct bnx2 *bp, struct bnx2_napi *bnapi, int budget)
if (len <= bp->rx_copy_thresh) { if (len <= bp->rx_copy_thresh) {
skb = netdev_alloc_skb(bp->dev, len + 6); skb = netdev_alloc_skb(bp->dev, len + 6);
if (skb == NULL) { if (!skb) {
bnx2_reuse_rx_data(bp, rxr, data, sw_ring_cons, bnx2_reuse_rx_data(bp, rxr, data, sw_ring_cons,
sw_ring_prod); sw_ring_prod);
goto next_rx; goto next_rx;
@ -3285,7 +3285,7 @@ next_rx:
sw_cons = BNX2_NEXT_RX_BD(sw_cons); sw_cons = BNX2_NEXT_RX_BD(sw_cons);
sw_prod = BNX2_NEXT_RX_BD(sw_prod); sw_prod = BNX2_NEXT_RX_BD(sw_prod);
if ((rx_pkt == budget)) if (rx_pkt == budget)
break; break;
/* Refresh hw_cons to see if there is new work */ /* Refresh hw_cons to see if there is new work */
@ -4561,7 +4561,7 @@ bnx2_nvram_write(struct bnx2 *bp, u32 offset, u8 *data_buf,
if (align_start || align_end) { if (align_start || align_end) {
align_buf = kmalloc(len32, GFP_KERNEL); align_buf = kmalloc(len32, GFP_KERNEL);
if (align_buf == NULL) if (!align_buf)
return -ENOMEM; return -ENOMEM;
if (align_start) { if (align_start) {
memcpy(align_buf, start, 4); memcpy(align_buf, start, 4);
@ -4575,7 +4575,7 @@ bnx2_nvram_write(struct bnx2 *bp, u32 offset, u8 *data_buf,
if (!(bp->flash_info->flags & BNX2_NV_BUFFERED)) { if (!(bp->flash_info->flags & BNX2_NV_BUFFERED)) {
flash_buffer = kmalloc(264, GFP_KERNEL); flash_buffer = kmalloc(264, GFP_KERNEL);
if (flash_buffer == NULL) { if (!flash_buffer) {
rc = -ENOMEM; rc = -ENOMEM;
goto nvram_write_end; goto nvram_write_end;
} }
@ -5440,7 +5440,7 @@ bnx2_free_tx_skbs(struct bnx2 *bp)
struct bnx2_tx_ring_info *txr = &bnapi->tx_ring; struct bnx2_tx_ring_info *txr = &bnapi->tx_ring;
int j; int j;
if (txr->tx_buf_ring == NULL) if (!txr->tx_buf_ring)
continue; continue;
for (j = 0; j < BNX2_TX_DESC_CNT; ) { for (j = 0; j < BNX2_TX_DESC_CNT; ) {
@ -5448,7 +5448,7 @@ bnx2_free_tx_skbs(struct bnx2 *bp)
struct sk_buff *skb = tx_buf->skb; struct sk_buff *skb = tx_buf->skb;
int k, last; int k, last;
if (skb == NULL) { if (!skb) {
j = BNX2_NEXT_TX_BD(j); j = BNX2_NEXT_TX_BD(j);
continue; continue;
} }
@ -5485,14 +5485,14 @@ bnx2_free_rx_skbs(struct bnx2 *bp)
struct bnx2_rx_ring_info *rxr = &bnapi->rx_ring; struct bnx2_rx_ring_info *rxr = &bnapi->rx_ring;
int j; int j;
if (rxr->rx_buf_ring == NULL) if (!rxr->rx_buf_ring)
return; return;
for (j = 0; j < bp->rx_max_ring_idx; j++) { for (j = 0; j < bp->rx_max_ring_idx; j++) {
struct bnx2_sw_bd *rx_buf = &rxr->rx_buf_ring[j]; struct bnx2_sw_bd *rx_buf = &rxr->rx_buf_ring[j];
u8 *data = rx_buf->data; u8 *data = rx_buf->data;
if (data == NULL) if (!data)
continue; continue;
dma_unmap_single(&bp->pdev->dev, dma_unmap_single(&bp->pdev->dev,
@ -6826,7 +6826,7 @@ bnx2_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *net_stats)
{ {
struct bnx2 *bp = netdev_priv(dev); struct bnx2 *bp = netdev_priv(dev);
if (bp->stats_blk == NULL) if (!bp->stats_blk)
return; return;
net_stats->rx_packets = net_stats->rx_packets =
@ -7217,7 +7217,7 @@ bnx2_get_eeprom_len(struct net_device *dev)
{ {
struct bnx2 *bp = netdev_priv(dev); struct bnx2 *bp = netdev_priv(dev);
if (bp->flash_info == NULL) if (!bp->flash_info)
return 0; return 0;
return (int) bp->flash_size; return (int) bp->flash_size;
@ -7678,7 +7678,7 @@ bnx2_get_ethtool_stats(struct net_device *dev,
u32 *temp_stats = (u32 *) bp->temp_stats_blk; u32 *temp_stats = (u32 *) bp->temp_stats_blk;
u8 *stats_len_arr = NULL; u8 *stats_len_arr = NULL;
if (hw_stats == NULL) { if (!hw_stats) {
memset(buf, 0, sizeof(u64) * BNX2_NUM_STATS); memset(buf, 0, sizeof(u64) * BNX2_NUM_STATS);
return; return;
} }
@ -8121,7 +8121,7 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
bp->temp_stats_blk = bp->temp_stats_blk =
kzalloc(sizeof(struct statistics_block), GFP_KERNEL); kzalloc(sizeof(struct statistics_block), GFP_KERNEL);
if (bp->temp_stats_blk == NULL) { if (!bp->temp_stats_blk) {
rc = -ENOMEM; rc = -ENOMEM;
goto err_out; goto err_out;
} }