@@ -1153,12 +1153,15 @@ int nvme_init_ctrl(nvme_host_t h, nvme_ctrl_t c, int instance)
11531153 goto out_free_name ;
11541154 }
11551155
1156- c -> address = nvme_get_attr (path , "address" );
1157- if (!c -> address ) {
1158- errno = ENXIO ;
1159- ret = -1 ;
1160- goto out_free_name ;
1156+ if (strcmp (c -> transport , "loop" )) {
1157+ c -> address = nvme_get_attr (path , "address" );
1158+ if (!c -> address ) {
1159+ errno = ENXIO ;
1160+ ret = -1 ;
1161+ goto out_free_name ;
1162+ }
11611163 }
1164+
11621165 subsys_name = nvme_ctrl_lookup_subsystem_name (c );
11631166 if (!subsys_name ) {
11641167 nvme_msg (LOG_ERR , "Failed to lookup subsystem name for %s\n" ,
@@ -1203,7 +1206,7 @@ static nvme_ctrl_t nvme_ctrl_alloc(nvme_subsystem_t s, const char *path,
12031206 const char * name )
12041207{
12051208 nvme_ctrl_t c ;
1206- char * addr , * address = NULL , * a , * e ;
1209+ char * addr = NULL , * address = NULL , * a , * e ;
12071210 char * transport , * traddr = NULL , * trsvcid = NULL ;
12081211 char * host_traddr = NULL , * host_iface = NULL ;
12091212 int ret ;
@@ -1213,6 +1216,8 @@ static nvme_ctrl_t nvme_ctrl_alloc(nvme_subsystem_t s, const char *path,
12131216 errno = ENXIO ;
12141217 return NULL ;
12151218 }
1219+ if (!strcmp (transport , "loop" ))
1220+ goto skip_address ;
12161221 /* Parse 'address' string into components */
12171222 addr = nvme_get_attr (path , "address" );
12181223 if (!addr ) {
@@ -1261,6 +1266,7 @@ static nvme_ctrl_t nvme_ctrl_alloc(nvme_subsystem_t s, const char *path,
12611266 a = strtok_r (NULL , "," , & e );
12621267 }
12631268 }
1269+ skip_address :
12641270 c = nvme_lookup_ctrl (s , transport , traddr ,
12651271 host_traddr , host_iface , trsvcid );
12661272 free (transport );
0 commit comments