git: ddec69e6a796 - main - ena: remove surplus NULL checks when freeing ENA resources
Marcin Wojtas
mw at FreeBSD.org
Thu Jun 24 14:35:50 UTC 2021
The branch main has been updated by mw:
URL: https://cgit.FreeBSD.org/src/commit/?id=ddec69e6a796283497ebada0569f34bd41bbdf37
commit ddec69e6a796283497ebada0569f34bd41bbdf37
Author: Marcin Wojtas <mw at FreeBSD.org>
AuthorDate: 2021-06-14 08:57:49 +0000
Commit: Marcin Wojtas <mw at 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 <ar at 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));
}
More information about the dev-commits-src-main
mailing list