Module Name:    src
Committed By:   pgoyette
Date:           Thu Apr 27 23:18:21 UTC 2017

Modified Files:
        src/sys/dev [prg-localcount2]: md.c

Log Message:
Don't reference a known-NULL pointer, and remove duplicated calls to
mutex_enter() and mutex_exit()


To generate a diff of this commit:
cvs rdiff -u -r1.78.6.1 -r1.78.6.2 src/sys/dev/md.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/md.c
diff -u src/sys/dev/md.c:1.78.6.1 src/sys/dev/md.c:1.78.6.2
--- src/sys/dev/md.c:1.78.6.1	Thu Apr 27 05:36:35 2017
+++ src/sys/dev/md.c	Thu Apr 27 23:18:21 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.c,v 1.78.6.1 2017/04/27 05:36:35 pgoyette Exp $	*/
+/*	$NetBSD: md.c,v 1.78.6.2 2017/04/27 23:18:21 pgoyette Exp $	*/
 
 /*
  * Copyright (c) 1995 Gordon W. Ross, Leo Weppelman.
@@ -40,7 +40,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: md.c,v 1.78.6.1 2017/04/27 05:36:35 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: md.c,v 1.78.6.2 2017/04/27 23:18:21 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_md.h"
@@ -294,7 +294,7 @@ mdopen(dev_t dev, int flag, int fmt, str
 		sc = device_private(self);
 		if (sc == NULL) {
 			mutex_exit(&md_device_lock);
-			device_release(sc->sc_dev);
+			device_release(self);
 			return ENOMEM;
 		}
 	}
@@ -450,7 +450,6 @@ mdstrategy(struct buf *bp)
 		bp->b_error = ENXIO;
 		goto done;
 	}
-	mutex_enter(&sc->sc_lock);
 
 	mutex_enter(&sc->sc_lock);
 
@@ -499,8 +498,6 @@ mdstrategy(struct buf *bp)
 	}
 	mutex_exit(&sc->sc_lock);
 
-	mutex_exit(&sc->sc_lock);
-
  done:
 	biodone(bp);
 	if (sc != NULL)

Reply via email to