Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev cons(4): Ignore error from vn_lock(vp, LK_EXCUSIVE|L...



details:   https://anonhg.NetBSD.org/src/rev/d458a34284f8
branches:  trunk
changeset: 369576:d458a34284f8
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Mon Aug 22 00:20:45 2022 +0000

description:
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:

 sys/dev/cons.c |  22 +++++++++-------------
 1 files changed, 9 insertions(+), 13 deletions(-)

diffs (50 lines):

diff -r a0990665da85 -r d458a34284f8 sys/dev/cons.c
--- a/sys/dev/cons.c    Mon Aug 22 00:20:36 2022 +0000
+++ b/sys/dev/cons.c    Mon Aug 22 00:20:45 2022 +0000
@@ -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 @@
                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 @@
 
        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;
 }
 



Home | Main Index | Thread Index | Old Index