git: 1ff44a05d6bc - stable/12 - if_stf: Delete unreachable code

From: Zhenlei Huang <zlei_at_FreeBSD.org>
Date: Wed, 17 May 2023 10:05:30 UTC
The branch stable/12 has been updated by zlei:

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

commit 1ff44a05d6bc9ada7ee9691c3a52f6a60438d0b5
Author:     Zhenlei Huang <zlei@FreeBSD.org>
AuthorDate: 2023-04-23 04:47:57 +0000
Commit:     Zhenlei Huang <zlei@FreeBSD.org>
CommitDate: 2023-05-17 10:02:12 +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)
    (cherry picked from commit f70caf1b4524c10d3a747770c69da9d7b6a56a22)
---
 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 098099052264..bdba588d2522 100644
--- a/sys/net/if_stf.c
+++ b/sys/net/if_stf.c
@@ -247,12 +247,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;