Module Name: src Committed By: riastradh Date: Mon Aug 22 00:20:56 UTC 2022
Modified Files: src/sys/dev: cons.c Log Message: cons(4): Don't barge ahead if cdevvp has failed -- return error now. To generate a diff of this commit: cvs rdiff -u -r1.78 -r1.79 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.78 src/sys/dev/cons.c:1.79 --- src/sys/dev/cons.c:1.78 Mon Aug 22 00:20:45 2022 +++ src/sys/dev/cons.c Mon Aug 22 00:20:56 2022 @@ -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, st } 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]);