git: 2a3147f96241 - stable/12 - ip_mroute: Delete unreachable code

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

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

commit 2a3147f962419e07e3eea69d74fece46c526dee2
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:29 +0000

    ip_mroute: 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 b658c0fce10a06493dc468fc9f6699120473e17b)
    (cherry picked from commit ece63e96c364679e19c124d145abe5af789d1948)
---
 sys/netinet/ip_mroute.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/sys/netinet/ip_mroute.c b/sys/netinet/ip_mroute.c
index 60b18cdbd35c..92074670cf60 100644
--- a/sys/netinet/ip_mroute.c
+++ b/sys/netinet/ip_mroute.c
@@ -2889,13 +2889,6 @@ ip_mroute_modevent(module_t mod, int type, void *unused)
 	    &pim_squelch_wholepkt);
 
 	pim_encap_cookie = ip_encap_attach(&ipv4_encap_cfg, NULL, M_WAITOK);
-	if (pim_encap_cookie == NULL) {
-		printf("ip_mroute: unable to attach pim encap\n");
-		VIF_LOCK_DESTROY();
-		MFC_LOCK_DESTROY();
-		MROUTER_LOCK_DESTROY();
-		return (EINVAL);
-	}
 
 	ip_mcast_src = X_ip_mcast_src;
 	ip_mforward = X_ip_mforward;