Module Name:    src
Committed By:   riastradh
Date:           Mon Aug 22 00:20:45 UTC 2022

Modified Files:
        src/sys/dev: cons.c

Log Message:
cons(4): Ignore error from vn_lock(vp, LK_EXCUSIVE|LK_RETRY).

This never fails, as is asserted in vn_lock whenever LK_RETRY is set
and LK_NOWAIT is not.


To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 src/sys/dev/cons.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/dev/cons.c
diff -u src/sys/dev/cons.c:1.77 src/sys/dev/cons.c:1.78
--- src/sys/dev/cons.c:1.77	Fri Dec  6 04:15:38 2019
+++ src/sys/dev/cons.c	Mon Aug 22 00:20:45 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: cons.c,v 1.77 2019/12/06 04:15:38 riastradh Exp $	*/
+/*	$NetBSD: cons.c,v 1.78 2022/08/22 00:20:45 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cons.c,v 1.77 2019/12/06 04:15:38 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cons.c,v 1.78 2022/08/22 00:20:45 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/proc.h>
@@ -133,11 +133,9 @@ cnopen(dev_t dev, int flag, int mode, st
 		return 0;
 	if ((error = cdevvp(cndev, &cn_devvp[unit])) != 0)
 		printf("cnopen: unable to get vnode reference\n");
-	error = vn_lock(cn_devvp[unit], LK_EXCLUSIVE | LK_RETRY);
-	if (error == 0) {
-		error = VOP_OPEN(cn_devvp[unit], flag, kauth_cred_get());
-		VOP_UNLOCK(cn_devvp[unit]);
-	}
+	vn_lock(cn_devvp[unit], LK_EXCLUSIVE | LK_RETRY);
+	error = VOP_OPEN(cn_devvp[unit], flag, kauth_cred_get());
+	VOP_UNLOCK(cn_devvp[unit]);
 	return error;
 }
 
@@ -154,12 +152,10 @@ cnclose(dev_t dev, int flag, int mode, s
 
 	vp = cn_devvp[unit];
 	cn_devvp[unit] = NULL;
-	error = vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
-	if (error == 0) {
-		error = VOP_CLOSE(vp, flag, kauth_cred_get());
-		VOP_UNLOCK(vp);
-		vrele(vp);
-	}
+	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
+	error = VOP_CLOSE(vp, flag, kauth_cred_get());
+	VOP_UNLOCK(vp);
+	vrele(vp);
 	return error;
 }
 

Reply via email to