lib/nvme: tolerate abnormal char device
In some special cases, NVMe device with cdata.nn=0 may be used to do validation or other test work. cdata.nn=0 means the device can't support NS at all. Change-Id: I55f75a8cb21b8d1b99c5318e27c876a4371d6dd4 Signed-off-by: Liu Xiaodong <xiaodong.liu@intel.com> Reviewed-on: https://review.gerrithub.io/432191 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: joevannip <jparairo@nvxltech.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
e93d56b1ed
commit
5aace13984
@ -909,6 +909,12 @@ nvme_ctrlr_identify_active_ns(struct spdk_nvme_ctrlr *ctrlr)
|
||||
uint32_t next_nsid = 0;
|
||||
uint32_t *new_ns_list = NULL;
|
||||
|
||||
if (ctrlr->num_ns == 0) {
|
||||
spdk_dma_free(ctrlr->active_ns_list);
|
||||
ctrlr->active_ns_list = NULL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* The allocated size must be a multiple of sizeof(struct spdk_nvme_ns_list)
|
||||
|
Loading…
Reference in New Issue
Block a user