git: c373e1d6adbc - main - if_stf: Delete unreachable code

From: Zhenlei Huang <zlei_at_FreeBSD.org>
Date: Sun, 23 Apr 2023 04:48:23 UTC
The branch main has been updated by zlei:

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

commit c373e1d6adbc3785e8f1072cdc4a062733baa514
Author:     Zhenlei Huang <zlei@FreeBSD.org>
AuthorDate: 2023-04-23 04:47:57 +0000
Commit:     Zhenlei Huang <zlei@FreeBSD.org>
CommitDate: 2023-04-23 04:47:57 +0000

    if_stf: Delete unreachable code
    
    As the flag M_WAITOK is passed to ip_encap_attach(), then the function
    will never return NULL, and the following code within NULL check branch
    will be unreachable.
    
    No functional change intended.
    
    Reviewed by:    kp
    Fixes:          6d8fdfa9d5e7d Rework IP encapsulation handling code
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D39746
---
 sys/net/if_stf.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/sys/net/if_stf.c b/sys/net/if_stf.c
index afc7b446fca7..5cb9a9d5c6dc 100644
--- a/sys/net/if_stf.c
+++ b/sys/net/if_stf.c
@@ -295,12 +295,6 @@ stf_clone_create(struct if_clone *ifc, char *name, size_t len,
 	ifp->if_dunit = IF_DUNIT_NONE;
 
 	sc->encap_cookie = ip_encap_attach(&ipv4_encap_cfg, sc, M_WAITOK);
-	if (sc->encap_cookie == NULL) {
-		if_printf(ifp, "attach failed\n");
-		free(sc, M_STF);
-		ifc_free_unit(ifc, unit);
-		return (ENOMEM);
-	}
 
 	ifp->if_mtu    = IPV6_MMTU;
 	ifp->if_ioctl  = stf_ioctl;