Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/dkwedge dk(4): dklastclose never fails. Make it ret...



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

description:
dk(4): dklastclose never fails.  Make it return void.

diffstat:

 sys/dev/dkwedge/dk.c |  21 +++++++++------------
 1 files changed, 9 insertions(+), 12 deletions(-)

diffs (85 lines):

diff -r 9c914e221d17 -r a0990665da85 sys/dev/dkwedge/dk.c
--- a/sys/dev/dkwedge/dk.c      Mon Aug 22 00:20:27 2022 +0000
+++ b/sys/dev/dkwedge/dk.c      Mon Aug 22 00:20:36 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dk.c,v 1.120 2022/08/22 00:20:27 riastradh Exp $       */
+/*     $NetBSD: dk.c,v 1.121 2022/08/22 00:20:36 riastradh Exp $       */
 
 /*-
  * Copyright (c) 2004, 2005, 2006, 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.120 2022/08/22 00:20:27 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.121 2022/08/22 00:20:36 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_dkwedge.h"
@@ -98,7 +98,7 @@
 static void    dkminphys(struct buf *);
 
 static int     dkfirstopen(struct dkwedge_softc *, int);
-static int     dklastclose(struct dkwedge_softc *);
+static void    dklastclose(struct dkwedge_softc *);
 static int     dkwedge_cleanup_parent(struct dkwedge_softc *, int);
 static int     dkwedge_detach(device_t, int);
 static void    dkwedge_delall1(struct disk *, bool);
@@ -588,7 +588,7 @@
                rc = EBUSY;
        }  else {
                mutex_enter(&sc->sc_parent->dk_rawlock);
-               rc = dklastclose(sc);
+               dklastclose(sc);
                mutex_exit(&sc->sc_parent->dk_rawlock);
        }
        mutex_exit(&sc->sc_dk.dk_openlock);
@@ -1215,7 +1215,7 @@
        return 0;
 }
 
-static int
+static void
 dklastclose(struct dkwedge_softc *sc)
 {
 
@@ -1233,8 +1233,6 @@
 
                dk_close_parent(vp, mode);
        }
-
-       return 0;
 }
 
 /*
@@ -1246,12 +1244,11 @@
 dkclose(dev_t dev, int flags, int fmt, struct lwp *l)
 {
        struct dkwedge_softc *sc = dkwedge_lookup(dev);
-       int error = 0;
 
        if (sc == NULL)
-               return (ENODEV);
+               return ENODEV;
        if (sc->sc_state != DKW_STATE_RUNNING)
-               return (ENXIO);
+               return ENXIO;
 
        KASSERT(sc->sc_dk.dk_openmask != 0);
 
@@ -1266,13 +1263,13 @@
 
        if (sc->sc_dk.dk_openmask == 0) {
                mutex_enter(&sc->sc_parent->dk_rawlock);
-               error = dklastclose(sc);
+               dklastclose(sc);
                mutex_exit(&sc->sc_parent->dk_rawlock);
        }
 
        mutex_exit(&sc->sc_dk.dk_openlock);
 
-       return (error);
+       return 0;
 }
 
 /*



Home | Main Index | Thread Index | Old Index