Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/dkwedge add missing mutex/cv cleanup to error paths.



details:   https://anonhg.NetBSD.org/src/rev/03b21a9dbf78
branches:  trunk
changeset: 349811:03b21a9dbf78
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Sat Dec 24 16:39:55 2016 +0000

description:
add missing mutex/cv cleanup to error paths.

diffstat:

 sys/dev/dkwedge/dk.c |  10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diffs (45 lines):

diff -r e38ad8cee07f -r 03b21a9dbf78 sys/dev/dkwedge/dk.c
--- a/sys/dev/dkwedge/dk.c      Sat Dec 24 15:49:18 2016 +0000
+++ b/sys/dev/dkwedge/dk.c      Sat Dec 24 16:39:55 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dk.c,v 1.92 2016/12/16 15:06:39 mlelstv Exp $  */
+/*     $NetBSD: dk.c,v 1.93 2016/12/24 16:39:55 mlelstv 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.92 2016/12/16 15:06:39 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.93 2016/12/24 16:39:55 mlelstv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_dkwedge.h"
@@ -369,6 +369,8 @@
        }
        mutex_exit(&pdk->dk_openlock);
        if (error) {
+               cv_destroy(&sc->sc_dkdrn);
+               mutex_destroy(&sc->sc_iolock);
                bufq_free(sc->sc_bufq);
                free(sc, M_DKWEDGE);
                return (error);
@@ -422,6 +424,8 @@
                LIST_REMOVE(sc, sc_plink);
                mutex_exit(&pdk->dk_openlock);
 
+               cv_destroy(&sc->sc_dkdrn);
+               mutex_destroy(&sc->sc_iolock);
                bufq_free(sc->sc_bufq);
                free(sc, M_DKWEDGE);
                return (error);
@@ -448,6 +452,8 @@
                LIST_REMOVE(sc, sc_plink);
                mutex_exit(&pdk->dk_openlock);
 
+               cv_destroy(&sc->sc_dkdrn);
+               mutex_destroy(&sc->sc_iolock);
                bufq_free(sc->sc_bufq);
                free(sc, M_DKWEDGE);
                return (ENOMEM);



Home | Main Index | Thread Index | Old Index