4a3e657cbc
- Upstream v1.0 Release Candidate 7 - Renamed python3-nvme subpackage to python3-libnvme
32 lines
972 B
Diff
32 lines
972 B
Diff
commit df80eb6a6357bbaa05dcad3503918745323ad8f1
|
|
Author: Tomas Bzatek <tbzatek@redhat.com>
|
|
Date: Tue Mar 22 16:22:30 2022 +0100
|
|
|
|
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.
|
|
|
|
diff --git a/src/nvme/tree.c b/src/nvme/tree.c
|
|
index 96106b0..0764690 100644
|
|
--- a/src/nvme/tree.c
|
|
+++ b/src/nvme/tree.c
|
|
@@ -1364,10 +1364,13 @@ nvme_ctrl_t nvme_scan_ctrl(nvme_root_t r, const char *name)
|
|
subsysname = nvme_ctrl_lookup_subsystem_name(r, name);
|
|
/* subsysname might be NULL here */
|
|
s = nvme_lookup_subsystem(h, subsysname, subsysnqn);
|
|
- if (subsysname)
|
|
- free(subsysname);
|
|
free(subsysnqn);
|
|
- if (!s) {
|
|
+
|
|
+ ret = 0;
|
|
+ if (s && !s->name)
|
|
+ ret = nvme_init_subsystem(s, subsysname);
|
|
+ free(subsysname);
|
|
+ if (!s || ret < 0) {
|
|
free(path);
|
|
errno = ENOMEM;
|
|
return NULL;
|