git: 86c8cbe788db - stable/13 - if_epair: Remove unneeded NULL check for the allocated ifnet

From: Zhenlei Huang <zlei_at_FreeBSD.org>
Date: Wed, 09 Oct 2024 04:02:42 UTC
The branch stable/13 has been updated by zlei:

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

commit 86c8cbe788db4d2fd3eb32d92a66a72840665d1a
Author:     Zhenlei Huang <zlei@FreeBSD.org>
AuthorDate: 2024-10-09 04:01:10 +0000
Commit:     Zhenlei Huang <zlei@FreeBSD.org>
CommitDate: 2024-10-09 04:01:10 +0000

    if_epair: Remove unneeded NULL check for the allocated ifnet
    
    This follows the recent MFC [1]. No functional change intended.
    
    This is a direct commit to stable/13.
    
    1. f500e5c6c99b net: Remove unneeded NULL check for the allocated ifnet
---
 sys/net/if_epair.c | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/sys/net/if_epair.c b/sys/net/if_epair.c
index e4b37f976a8c..9482b30251b7 100644
--- a/sys/net/if_epair.c
+++ b/sys/net/if_epair.c
@@ -553,11 +553,6 @@ epair_clone_create(struct if_clone *ifc, char *name, size_t len, caddr_t params)
 	sca = malloc(sizeof(struct epair_softc), M_EPAIR, M_WAITOK | M_ZERO);
 	sca->ifp = if_alloc(IFT_ETHER);
 	sca->num_queues = epair_tasks.tasks;
-	if (sca->ifp == NULL) {
-		free(sca, M_EPAIR);
-		ifc_free_unit(ifc, unit);
-		return (ENOSPC);
-	}
 	sca->queues = mallocarray(sca->num_queues, sizeof(struct epair_queue),
 	    M_EPAIR, M_WAITOK);
 	for (int i = 0; i < sca->num_queues; i++) {
@@ -573,13 +568,6 @@ epair_clone_create(struct if_clone *ifc, char *name, size_t len, caddr_t params)
 	scb = malloc(sizeof(struct epair_softc), M_EPAIR, M_WAITOK | M_ZERO);
 	scb->ifp = if_alloc(IFT_ETHER);
 	scb->num_queues = epair_tasks.tasks;
-	if (scb->ifp == NULL) {
-		free(scb, M_EPAIR);
-		if_free(sca->ifp);
-		free(sca, M_EPAIR);
-		ifc_free_unit(ifc, unit);
-		return (ENOSPC);
-	}
 	scb->queues = mallocarray(scb->num_queues, sizeof(struct epair_queue),
 	    M_EPAIR, M_WAITOK);
 	for (int i = 0; i < scb->num_queues; i++) {