git: 418d3190d73c - stable/14 - ena: Fix customer metrics deallocation statement place

From: Osama Abboud <osamaabb_at_FreeBSD.org>
Date: Thu, 31 Oct 2024 16:01:21 UTC
The branch stable/14 has been updated by osamaabb:

URL: https://cgit.FreeBSD.org/src/commit/?id=418d3190d73cdca08bc91ad313bf39ebab3b32af

commit 418d3190d73cdca08bc91ad313bf39ebab3b32af
Author:     Osama Abboud <osamaabb@amazon.com>
AuthorDate: 2024-08-07 06:24:22 +0000
Commit:     Osama Abboud <osamaabb@FreeBSD.org>
CommitDate: 2024-10-31 14:54:10 +0000

    ena: Fix customer metrics deallocation statement place
    
    Upstream commit [1] made if_alloc_domain() never fail, then also do the
    wrappers if_alloc(), if_alloc_dev(), and if_gethandle().
    
    Upstream commit [2] removed the NULL check conducted by the driver.
    This commit also removes err_customer_metrics_alloc goto label.
    
    Commit [2] leaves behind a floating free() statement that
    deallocates customer_metrics_array. This commit places the
    deallocation statement where it belongs.
    
    [1] commit 4787572d0580 ("ifnet: make if_alloc_domain() never fail")
    [2] commit aa3860851b9f ("net: Remove unneeded NULL check for the allocated ifnet")
    
    Approved by: cperciva (mentor)
    Sponsored by: Amazon, Inc.
    
    (cherry picked from commit 5517ca8486bfbf4d0cd369898f3e4d10cd614a9a)
---
 sys/dev/ena/ena.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/dev/ena/ena.c b/sys/dev/ena/ena.c
index 47d066a2e4f1..9d047cc89b30 100644
--- a/sys/dev/ena/ena.c
+++ b/sys/dev/ena/ena.c
@@ -3841,8 +3841,8 @@ ena_attach(device_t pdev)
 #ifdef DEV_NETMAP
 err_detach:
 	ether_ifdetach(adapter->ifp);
-#endif /* DEV_NETMAP */
 	free(adapter->customer_metrics_array, M_DEVBUF);
+#endif /* DEV_NETMAP */
 err_metrics_buffer_destroy:
 	ena_com_delete_customer_metrics_buffer(ena_dev);
 err_msix_free: