summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authornonaka <nonaka@NetBSD.org>2019-09-26 11:50:32 +0000
committernonaka <nonaka@NetBSD.org>2019-09-26 11:50:32 +0000
commit04791bbc33537745b7ed3d5ac0dbfbc6f64d3b1a (patch)
tree0af953d2867778e688b6f897af1616ed10f19d4b /sys/dev
parent607f5a6073ffe77602b2dd56b6659d9400069ca5 (diff)
nvme(4): Don't attach the device, if namespace not found.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ic/nvme.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/dev/ic/nvme.c b/sys/dev/ic/nvme.c
index fa5d3ccaba2..fdb75c9a989 100644
--- a/sys/dev/ic/nvme.c
+++ b/sys/dev/ic/nvme.c
@@ -1,4 +1,4 @@
-/* $NetBSD: nvme.c,v 1.45 2019/09/20 05:32:42 nonaka Exp $ */
+/* $NetBSD: nvme.c,v 1.46 2019/09/26 11:50:32 nonaka Exp $ */
/* $OpenBSD: nvme.c,v 1.49 2016/04/18 05:59:50 dlg Exp $ */
/*
@@ -18,7 +18,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.45 2019/09/20 05:32:42 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.46 2019/09/26 11:50:32 nonaka Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -399,6 +399,10 @@ nvme_attach(struct nvme_softc *sc)
aprint_error_dev(sc->sc_dev, "unable to identify controller\n");
goto disable;
}
+ if (sc->sc_nn == 0) {
+ aprint_error_dev(sc->sc_dev, "namespace not found\n");
+ goto disable;
+ }
/* we know how big things are now */
sc->sc_max_sgl = sc->sc_mdts / sc->sc_mps;