Skip to content

Commit df80eb6

Browse files
committed
tree: Fix subsystem initialization in nvme_scan_ctrl()
The subsystem instance would normally get properly initialized in later stages of topology scanning, unless there's a host mismatch and the instance would stand alone.
1 parent 8d05597 commit df80eb6

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

src/nvme/tree.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1364,10 +1364,13 @@ nvme_ctrl_t nvme_scan_ctrl(nvme_root_t r, const char *name)
13641364
subsysname = nvme_ctrl_lookup_subsystem_name(r, name);
13651365
/* subsysname might be NULL here */
13661366
s = nvme_lookup_subsystem(h, subsysname, subsysnqn);
1367-
if (subsysname)
1368-
free(subsysname);
13691367
free(subsysnqn);
1370-
if (!s) {
1368+
1369+
ret = 0;
1370+
if (s && !s->name)
1371+
ret = nvme_init_subsystem(s, subsysname);
1372+
free(subsysname);
1373+
if (!s || ret < 0) {
13711374
free(path);
13721375
errno = ENOMEM;
13731376
return NULL;

0 commit comments

Comments
 (0)