Blame nvme_scan_ctrl_2.patch

Tomas Bzatek 4a3e65
commit 01ffcb46259205fe4a9b49aecc8888253dfbf7a2
Tomas Bzatek 4a3e65
Author: Tomas Bzatek <tbzatek@redhat.com>
Tomas Bzatek 4a3e65
Date:   Wed Mar 23 13:17:02 2022 +0100
Tomas Bzatek 4a3e65
Tomas Bzatek 4a3e65
    tree: Handle NULL subsysname in nvme_scan_ctrl()
Tomas Bzatek 4a3e65
    
Tomas Bzatek 4a3e65
    As noted couple of lines earlier, the subsysname string might
Tomas Bzatek 4a3e65
    be NULL. In that case, defer initialization of nvme_subsystem_t
Tomas Bzatek 4a3e65
    in hope that it would get initialized while scanning subsystems.
Tomas Bzatek 4a3e65
Tomas Bzatek 4a3e65
diff --git a/src/nvme/tree.c b/src/nvme/tree.c
Tomas Bzatek 4a3e65
index 0764690..5042a8e 100644
Tomas Bzatek 4a3e65
--- a/src/nvme/tree.c
Tomas Bzatek 4a3e65
+++ b/src/nvme/tree.c
Tomas Bzatek 4a3e65
@@ -1367,7 +1367,7 @@ nvme_ctrl_t nvme_scan_ctrl(nvme_root_t r, const char *name)
Tomas Bzatek 4a3e65
 	free(subsysnqn);
Tomas Bzatek 4a3e65
 
Tomas Bzatek 4a3e65
 	ret = 0;
Tomas Bzatek 4a3e65
-	if (s && !s->name)
Tomas Bzatek 4a3e65
+	if (s && !s->name && subsysname)
Tomas Bzatek 4a3e65
 		ret = nvme_init_subsystem(s, subsysname);
Tomas Bzatek 4a3e65
 	free(subsysname);
Tomas Bzatek 4a3e65
 	if (!s || ret < 0) {