summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/ic/nvme.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/sys/dev/ic/nvme.c b/sys/dev/ic/nvme.c
index 43784dabc3f..3f18cb2037a 100644
--- a/sys/dev/ic/nvme.c
+++ b/sys/dev/ic/nvme.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nvme.c,v 1.76 2020/06/27 14:29:45 krw Exp $ */
+/* $OpenBSD: nvme.c,v 1.77 2020/06/29 15:01:58 krw Exp $ */
/*
* Copyright (c) 2014 David Gwynne <dlg@openbsd.org>
@@ -463,19 +463,14 @@ nvme_scsi_probe(struct scsi_link *link)
scsi_io_put(&sc->sc_iopool, ccb);
- if (rv != 0) {
- rv = EIO;
- goto done;
+ identify = NVME_DMA_KVA(mem);
+ if (rv == 0 && lemtoh64(&identify->nsze) > 0) {
+ /* Commit namespace if it has a size greater than zero. */
+ identify = malloc(sizeof(*identify), M_DEVBUF, M_WAITOK);
+ memcpy(identify, NVME_DMA_KVA(mem), sizeof(*identify));
+ sc->sc_namespaces[link->target].ident = identify;
}
- /* commit */
-
- identify = malloc(sizeof(*identify), M_DEVBUF, M_WAITOK|M_ZERO);
- memcpy(identify, NVME_DMA_KVA(mem), sizeof(*identify));
-
- sc->sc_namespaces[link->target].ident = identify;
-
-done:
nvme_dmamem_free(sc, mem);
return (rv);