summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorriastradh <riastradh@NetBSD.org>2022-08-22 00:20:56 +0000
committerriastradh <riastradh@NetBSD.org>2022-08-22 00:20:56 +0000
commite25e539efc52b2d4957f3194c50a870748ff5bd2 (patch)
treedd242a0d0f47ac5ef8bd5d08a0be96674227eb56 /sys/dev
parent97611a4336544b903ccad0a917c35aceaed5b334 (diff)
cons(4): Don't barge ahead if cdevvp has failed -- return error now.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/cons.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/dev/cons.c b/sys/dev/cons.c
index 83b8e88a34e..eef38cbbc51 100644
--- a/sys/dev/cons.c
+++ b/sys/dev/cons.c
@@ -1,4 +1,4 @@
-/* $NetBSD: cons.c,v 1.78 2022/08/22 00:20:45 riastradh Exp $ */
+/* $NetBSD: cons.c,v 1.79 2022/08/22 00:20:56 riastradh Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cons.c,v 1.78 2022/08/22 00:20:45 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cons.c,v 1.79 2022/08/22 00:20:56 riastradh Exp $");
#include <sys/param.h>
#include <sys/proc.h>
@@ -131,8 +131,10 @@ cnopen(dev_t dev, int flag, int mode, struct lwp *l)
}
if (cn_devvp[unit] != NULLVP)
return 0;
- if ((error = cdevvp(cndev, &cn_devvp[unit])) != 0)
+ if ((error = cdevvp(cndev, &cn_devvp[unit])) != 0) {
printf("cnopen: unable to get vnode reference\n");
+ return error;
+ }
vn_lock(cn_devvp[unit], LK_EXCLUSIVE | LK_RETRY);
error = VOP_OPEN(cn_devvp[unit], flag, kauth_cred_get());
VOP_UNLOCK(cn_devvp[unit]);