summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorriastradh <riastradh@NetBSD.org>2022-08-22 00:20:45 +0000
committerriastradh <riastradh@NetBSD.org>2022-08-22 00:20:45 +0000
commit97611a4336544b903ccad0a917c35aceaed5b334 (patch)
treeaa3b74420c17f8958b045234dad0447b2068910c /sys/dev
parent610b020b0154d644e307c3bd20e4c6910b79f5d4 (diff)
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.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/cons.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/sys/dev/cons.c b/sys/dev/cons.c
index 72eef6ec0b1..83b8e88a34e 100644
--- a/sys/dev/cons.c
+++ b/sys/dev/cons.c
@@ -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, struct lwp *l)
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, struct lwp *l)
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;
}