Commit f95936cc authored by Markus Elfring's avatar Markus Elfring Committed by David S. Miller

net: mvneta: Adjust six checks for null pointers

MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The script “checkpatch.pl” pointed information out like the following.

Comparison to NULL could be written …

Thus fix the affected source code places.
Signed-off-by: default avatarMarkus Elfring <elfring@users.sourceforge.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d441b688
...@@ -1107,7 +1107,7 @@ static void mvneta_port_up(struct mvneta_port *pp) ...@@ -1107,7 +1107,7 @@ static void mvneta_port_up(struct mvneta_port *pp)
q_map = 0; q_map = 0;
for (queue = 0; queue < txq_number; queue++) { for (queue = 0; queue < txq_number; queue++) {
struct mvneta_tx_queue *txq = &pp->txqs[queue]; struct mvneta_tx_queue *txq = &pp->txqs[queue];
if (txq->descs != NULL) if (txq->descs)
q_map |= (1 << queue); q_map |= (1 << queue);
} }
mvreg_write(pp, MVNETA_TXQ_CMD, q_map); mvreg_write(pp, MVNETA_TXQ_CMD, q_map);
...@@ -1116,7 +1116,7 @@ static void mvneta_port_up(struct mvneta_port *pp) ...@@ -1116,7 +1116,7 @@ static void mvneta_port_up(struct mvneta_port *pp)
for (queue = 0; queue < rxq_number; queue++) { for (queue = 0; queue < rxq_number; queue++) {
struct mvneta_rx_queue *rxq = &pp->rxqs[queue]; struct mvneta_rx_queue *rxq = &pp->rxqs[queue];
if (rxq->descs != NULL) if (rxq->descs)
q_map |= (1 << queue); q_map |= (1 << queue);
} }
mvreg_write(pp, MVNETA_RXQ_CMD, q_map); mvreg_write(pp, MVNETA_RXQ_CMD, q_map);
...@@ -2850,7 +2850,7 @@ static int mvneta_rxq_init(struct mvneta_port *pp, ...@@ -2850,7 +2850,7 @@ static int mvneta_rxq_init(struct mvneta_port *pp,
rxq->descs = dma_alloc_coherent(pp->dev->dev.parent, rxq->descs = dma_alloc_coherent(pp->dev->dev.parent,
rxq->size * MVNETA_DESC_ALIGNED_SIZE, rxq->size * MVNETA_DESC_ALIGNED_SIZE,
&rxq->descs_phys, GFP_KERNEL); &rxq->descs_phys, GFP_KERNEL);
if (rxq->descs == NULL) if (!rxq->descs)
return -ENOMEM; return -ENOMEM;
rxq->last_desc = rxq->size - 1; rxq->last_desc = rxq->size - 1;
...@@ -2920,7 +2920,7 @@ static int mvneta_txq_init(struct mvneta_port *pp, ...@@ -2920,7 +2920,7 @@ static int mvneta_txq_init(struct mvneta_port *pp,
txq->descs = dma_alloc_coherent(pp->dev->dev.parent, txq->descs = dma_alloc_coherent(pp->dev->dev.parent,
txq->size * MVNETA_DESC_ALIGNED_SIZE, txq->size * MVNETA_DESC_ALIGNED_SIZE,
&txq->descs_phys, GFP_KERNEL); &txq->descs_phys, GFP_KERNEL);
if (txq->descs == NULL) if (!txq->descs)
return -ENOMEM; return -ENOMEM;
txq->last_desc = txq->size - 1; txq->last_desc = txq->size - 1;
...@@ -2935,7 +2935,7 @@ static int mvneta_txq_init(struct mvneta_port *pp, ...@@ -2935,7 +2935,7 @@ static int mvneta_txq_init(struct mvneta_port *pp,
txq->tx_skb = kmalloc_array(txq->size, sizeof(*txq->tx_skb), txq->tx_skb = kmalloc_array(txq->size, sizeof(*txq->tx_skb),
GFP_KERNEL); GFP_KERNEL);
if (txq->tx_skb == NULL) { if (!txq->tx_skb) {
dma_free_coherent(pp->dev->dev.parent, dma_free_coherent(pp->dev->dev.parent,
txq->size * MVNETA_DESC_ALIGNED_SIZE, txq->size * MVNETA_DESC_ALIGNED_SIZE,
txq->descs, txq->descs_phys); txq->descs, txq->descs_phys);
...@@ -2946,7 +2946,7 @@ static int mvneta_txq_init(struct mvneta_port *pp, ...@@ -2946,7 +2946,7 @@ static int mvneta_txq_init(struct mvneta_port *pp,
txq->tso_hdrs = dma_alloc_coherent(pp->dev->dev.parent, txq->tso_hdrs = dma_alloc_coherent(pp->dev->dev.parent,
txq->size * TSO_HEADER_SIZE, txq->size * TSO_HEADER_SIZE,
&txq->tso_hdrs_phys, GFP_KERNEL); &txq->tso_hdrs_phys, GFP_KERNEL);
if (txq->tso_hdrs == NULL) { if (!txq->tso_hdrs) {
kfree(txq->tx_skb); kfree(txq->tx_skb);
dma_free_coherent(pp->dev->dev.parent, dma_free_coherent(pp->dev->dev.parent,
txq->size * MVNETA_DESC_ALIGNED_SIZE, txq->size * MVNETA_DESC_ALIGNED_SIZE,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment