Re: [PATCH 2/3] net/gve: remove unnecessary check for NULL
Joshua Washington <[email protected]> Thu, 30 Jul 2026 09:32:03 -0700
| Newsgroups | org.dpdk.dev |
|---|---|
| Message-ID | <CALuQH+WpRLpWeQyT939DY5Hc9iZbWX1KxZ-_ZftBqZZqo3FnCw@mail.gmail.com> |
On Tue, Jul 28, 2026 at 7:12 AM Stephen Hemminger <[email protected]> wrote: > > Checking for NULL before calling rte_free is unnecessary. > Found by cocci/nullfree.cocci script. > > Signed-off-by: Stephen Hemminger <[email protected]> Reviewed-by: Joshua Washington <[email protected]> > --- > drivers/net/gve/gve_rx.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/gve/gve_rx.c b/drivers/net/gve/gve_rx.c > index 567b82d020..932293ddad 100644 > --- a/drivers/net/gve/gve_rx.c > +++ b/drivers/net/gve/gve_rx.c > @@ -205,8 +205,9 @@ gve_rx_burst(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) > if (gve_rx(rxq, rxd, rx_id)) { > if (!ctx->drop_pkt) > rx_pkts[nb_rx++] = ctx->mbuf_head; > - else if (ctx->mbuf_head != NULL) > + else { > rte_pktmbuf_free(ctx->mbuf_head); > + } > rxq->nb_avail += ctx->total_frags; > gve_rx_ctx_clear(ctx); > } > -- > 2.53.0 >