git: f70caf1b4524 - stable/13 - if_stf: Delete unreachable code

From: Zhenlei Huang <zlei_at_FreeBSD.org>
Date: Wed, 17 May 2023 09:59:11 UTC
The branch stable/13 has been updated by zlei:

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

commit f70caf1b4524c10d3a747770c69da9d7b6a56a22
Author:     Zhenlei Huang <zlei@FreeBSD.org>
AuthorDate: 2023-04-23 04:47:57 +0000
Commit:     Zhenlei Huang <zlei@FreeBSD.org>
CommitDate: 2023-05-17 09:57:07 +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
    
    (cherry picked from commit c373e1d6adbc3785e8f1072cdc4a062733baa514)
---
 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 d5ffdeabdf53..d0303665d478 100644
--- a/sys/net/if_stf.c
+++ b/sys/net/if_stf.c
@@ -249,12 +249,6 @@ stf_clone_create(struct if_clone *ifc, char *name, size_t len, caddr_t params)
 	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;