net: libwx: fix an error code in wx_alloc_page_pool()
authorDan Carpenter <error27@gmail.com>
Thu, 9 Feb 2023 13:43:06 +0000 (16:43 +0300)
committerJakub Kicinski <kuba@kernel.org>
Sat, 11 Feb 2023 03:37:13 +0000 (19:37 -0800)
This function always returns success.  We need to preserve the error
code before setting rx_ring->page_pool = NULL.

Fixes: 850b971110b2 ("net: libwx: Allocate Rx and Tx resources")
Signed-off-by: Dan Carpenter <error27@gmail.com>
Link: https://lore.kernel.org/r/Y+T4aoefc1XWvGYb@kili
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/wangxun/libwx/wx_lib.c

index 2ee286b2b17788b341a4b31bfb5f6751700f7216..eb89a274083e79d02b3ac632084a72618ce318df 100644 (file)
@@ -1745,8 +1745,8 @@ static int wx_alloc_page_pool(struct wx_ring *rx_ring)
 
        rx_ring->page_pool = page_pool_create(&pp_params);
        if (IS_ERR(rx_ring->page_pool)) {
-               rx_ring->page_pool = NULL;
                ret = PTR_ERR(rx_ring->page_pool);
+               rx_ring->page_pool = NULL;
        }
 
        return ret;