Module Name:    src
Committed By:   riastradh
Date:           Wed Apr 17 18:32:13 UTC 2024

Modified Files:
        src/sys/net: if_tap.c

Log Message:
tap(4): Prune dead branches around tap_dev_close.

No functional change intended.

PR kern/58166


To generate a diff of this commit:
cvs rdiff -u -r1.128 -r1.129 src/sys/net/if_tap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/net/if_tap.c
diff -u src/sys/net/if_tap.c:1.128 src/sys/net/if_tap.c:1.129
--- src/sys/net/if_tap.c:1.128	Fri Jan  6 01:54:22 2023
+++ src/sys/net/if_tap.c	Wed Apr 17 18:32:13 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_tap.c,v 1.128 2023/01/06 01:54:22 ozaki-r Exp $	*/
+/*	$NetBSD: if_tap.c,v 1.129 2024/04/17 18:32:13 riastradh Exp $	*/
 
 /*
  *  Copyright (c) 2003, 2004, 2008, 2009 The NetBSD Foundation.
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_tap.c,v 1.128 2023/01/06 01:54:22 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_tap.c,v 1.129 2024/04/17 18:32:13 riastradh Exp $");
 
 #if defined(_KERNEL_OPT)
 
@@ -117,7 +117,7 @@ CFATTACH_DECL_NEW(tap, sizeof(struct tap
 extern struct cfdriver tap_cd;
 
 /* Real device access routines */
-static int	tap_dev_close(struct tap_softc *);
+static void	tap_dev_close(struct tap_softc *);
 static int	tap_dev_read(int, struct uio *, int);
 static int	tap_dev_write(int, struct uio *, int);
 static int	tap_dev_ioctl(int, u_long, void *, struct lwp *);
@@ -759,7 +759,8 @@ tap_cdev_close(dev_t dev, int flags, int
 	if (sc == NULL)
 		return ENXIO;
 
-	return tap_dev_close(sc);
+	tap_dev_close(sc);
+	return 0;
 }
 
 /*
@@ -779,13 +780,8 @@ tap_fops_close(file_t *fp)
 	if (sc == NULL)
 		return ENXIO;
 
-	/* tap_dev_close currently always succeeds, but it might not
-	 * always be the case. */
 	KERNEL_LOCK(1, NULL);
-	if ((error = tap_dev_close(sc)) != 0) {
-		KERNEL_UNLOCK_ONE(NULL);
-		return error;
-	}
+	tap_dev_close(sc);
 
 	/* Destroy the device now that it is no longer useful,
 	 * unless it's already being destroyed. */
@@ -799,7 +795,7 @@ tap_fops_close(file_t *fp)
 	return error;
 }
 
-static int
+static void
 tap_dev_close(struct tap_softc *sc)
 {
 	struct ifnet *ifp;
@@ -832,8 +828,6 @@ tap_dev_close(struct tap_softc *sc)
 	}
 	sc->sc_flags &= ~(TAP_INUSE | TAP_ASYNCIO);
 	if_link_state_change(ifp, LINK_STATE_DOWN);
-
-	return 0;
 }
 
 static int

Reply via email to