Module Name:    src
Committed By:   mlelstv
Date:           Sat Oct  5 05:28:44 UTC 2019

Modified Files:
        src/sys/dev: dksubr.c

Log Message:
Bail when dkdriver hasn't been initialized. This can happen when
attachment failed or when it hasn't finished yet.


To generate a diff of this commit:
cvs rdiff -u -r1.109 -r1.110 src/sys/dev/dksubr.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/dksubr.c
diff -u src/sys/dev/dksubr.c:1.109 src/sys/dev/dksubr.c:1.110
--- src/sys/dev/dksubr.c:1.109	Fri Jun 28 14:56:46 2019
+++ src/sys/dev/dksubr.c	Sat Oct  5 05:28:44 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: dksubr.c,v 1.109 2019/06/28 14:56:46 jmcneill Exp $ */
+/* $NetBSD: dksubr.c,v 1.110 2019/10/05 05:28:44 mlelstv Exp $ */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 1999, 2002, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dksubr.c,v 1.109 2019/06/28 14:56:46 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dksubr.c,v 1.110 2019/10/05 05:28:44 mlelstv Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -147,6 +147,12 @@ dk_open(struct dk_softc *dksc, dev_t dev
 		goto done;
 	}
 
+	/* If no dkdriver attached, bail */
+	if (dkd == NULL) {
+		ret = ENXIO;
+		goto done;
+	}
+
 	/*
 	 * initialize driver for the first opener
 	 */

Reply via email to