From: Dan Carpenter Date: Wed, 13 Oct 2021 08:04:56 +0000 (+0300) Subject: net: enetc: fix check for allocation failure X-Git-Tag: v6.1-rc5~2768^2~208 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e79d82643a69df03d59fe47e32619515a83e4969;p=platform%2Fkernel%2Flinux-starfive.git net: enetc: fix check for allocation failure This was supposed to be a check for if dma_alloc_coherent() failed but it has a copy and paste bug so it will not work. Fixes: fb8629e2cbfc ("net: enetc: add support for software TSO") Signed-off-by: Dan Carpenter Reviewed-by: Ioana Ciornei Link: https://lore.kernel.org/r/20211013080456.GC6010@kili Signed-off-by: Jakub Kicinski --- diff --git a/drivers/net/ethernet/freescale/enetc/enetc.c b/drivers/net/ethernet/freescale/enetc/enetc.c index 3ae4f49a9055..8e31fe15bf3c 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc.c +++ b/drivers/net/ethernet/freescale/enetc/enetc.c @@ -1767,8 +1767,10 @@ static int enetc_alloc_txbdr(struct enetc_bdr *txr) txr->bd_count * TSO_HEADER_SIZE, &txr->tso_headers_dma, GFP_KERNEL); - if (err) + if (!txr->tso_headers) { + err = -ENOMEM; goto err_alloc_tso; + } txr->next_to_clean = 0; txr->next_to_use = 0;