net/virtio: remove useless pointer checks
authorMaxime Coquelin <maxime.coquelin@redhat.com>
Wed, 5 Jun 2019 10:00:39 +0000 (12:00 +0200)
committerFerruh Yigit <ferruh.yigit@intel.com>
Thu, 13 Jun 2019 14:54:29 +0000 (23:54 +0900)
This patch removes useless checks on 'prev' pointer, as it
is always set before with a valid value.

Reviewed-by: David Marchand <david.marchand@redhat.com>
Reviewed-by: Tiwei Bie <tiwei.bie@intel.com>
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
drivers/net/virtio/virtio_rxtx.c

index 8dccd69..1f11784 100644 (file)
@@ -1512,9 +1512,7 @@ virtio_recv_pkts_inorder(void *rx_queue,
 
                        rx_pkts[nb_rx]->pkt_len += (uint32_t)(len[i]);
 
-                       if (prev)
-                               prev->next = rxm;
-
+                       prev->next = rxm;
                        prev = rxm;
                        seg_res -= 1;
                }
@@ -1696,9 +1694,7 @@ virtio_recv_mergeable_pkts(void *rx_queue,
 
                        rx_pkts[nb_rx]->pkt_len += (uint32_t)(len[i]);
 
-                       if (prev)
-                               prev->next = rxm;
-
+                       prev->next = rxm;
                        prev = rxm;
                        seg_res -= 1;
                }
@@ -1871,9 +1867,7 @@ virtio_recv_mergeable_pkts_packed(void *rx_queue,
 
                        rx_pkts[nb_rx]->pkt_len += (uint32_t)(len[i]);
 
-                       if (prev)
-                               prev->next = rxm;
-
+                       prev->next = rxm;
                        prev = rxm;
                        seg_res -= 1;
                }
@@ -1916,8 +1910,7 @@ virtio_recv_mergeable_pkts_packed(void *rx_queue,
                } else {
                        PMD_RX_LOG(ERR,
                                        "No enough segments for packet.");
-                       if (prev)
-                               virtio_discard_rxbuf(vq, prev);
+                       virtio_discard_rxbuf(vq, prev);
                        rxvq->stats.errors++;
                        break;
                }