The branch main has been updated by mw:

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

commit ddec69e6a796283497ebada0569f34bd41bbdf37
Author:     Marcin Wojtas <m...@freebsd.org>
AuthorDate: 2021-06-14 08:57:49 +0000
Commit:     Marcin Wojtas <m...@freebsd.org>
CommitDate: 2021-06-24 14:02:39 +0000

    ena: remove surplus NULL checks when freeing ENA resources
    
    Calling free on a NULL pointer is valid, as appropriate check is already
    done internally:
    
    /* free(NULL, ...) does nothing */
    if (addr == NULL)
        return;
    
    Submitted by: Artur Rojek <a...@semihalf.com>
    Obtained from: Semihalf
    MFC after: 2 weeks
    Sponsored by: Amazon, Inc.
---
 sys/dev/ena/ena.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/sys/dev/ena/ena.c b/sys/dev/ena/ena.c
index 20da750bcac0..d7a68e94d361 100644
--- a/sys/dev/ena/ena.c
+++ b/sys/dev/ena/ena.c
@@ -1898,8 +1898,7 @@ ena_disable_msix(struct ena_adapter *adapter)
        }
 
        adapter->msix_vecs = 0;
-       if (adapter->msix_entries != NULL)
-               free(adapter->msix_entries, M_DEVBUF);
+       free(adapter->msix_entries, M_DEVBUF);
        adapter->msix_entries = NULL;
 }
 
@@ -3863,11 +3862,9 @@ ena_detach(device_t pdev)
 
        if_free(adapter->ifp);
 
-       if (ena_dev->bus != NULL)
-               free(ena_dev->bus, M_DEVBUF);
+       free(ena_dev->bus, M_DEVBUF);
 
-       if (ena_dev != NULL)
-               free(ena_dev, M_DEVBUF);
+       free(ena_dev, M_DEVBUF);
 
        return (bus_generic_detach(pdev));
 }
_______________________________________________
dev-commits-src-main@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "dev-commits-src-main-unsubscr...@freebsd.org"

Reply via email to