From 88457055b4617d52dd2bd810a6c60ce9afcca9ee Mon Sep 17 00:00:00 2001 From: Hannes Reinecke Date: Tue, 28 Sep 2021 11:55:07 +0200 Subject: [PATCH] tree: use name as argument to nvme_ctrl_lookup_subsystem_name() When looking up the subsystem in ctrl_lookup_subsystem_name() we only need the controller name, not the entire controller structure. Signed-off-by: Hannes Reinecke --- src/nvme/tree.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/nvme/tree.c b/src/nvme/tree.c index a782f04a..396f521a 100644 --- a/src/nvme/tree.c +++ b/src/nvme/tree.c @@ -1075,7 +1075,7 @@ static int nvme_ctrl_scan_namespaces(struct nvme_ctrl *c) return 0; } -static char *nvme_ctrl_lookup_subsystem_name(nvme_ctrl_t c) +static char *nvme_ctrl_lookup_subsystem_name(char *ctrl_name) { struct dirent **subsys; char *subsys_name = NULL; @@ -1089,7 +1089,7 @@ static char *nvme_ctrl_lookup_subsystem_name(nvme_ctrl_t c) struct stat st; sprintf(path, "%s/%s/%s", nvme_subsys_sysfs_dir, - subsys[i]->d_name, c->name); + subsys[i]->d_name, ctrl_name); nvme_msg(LOG_DEBUG, "lookup subsystem %s\n", path); if (stat(path, &st) < 0) continue; @@ -1162,7 +1162,7 @@ int nvme_init_ctrl(nvme_host_t h, nvme_ctrl_t c, int instance) } } - subsys_name = nvme_ctrl_lookup_subsystem_name(c); + subsys_name = nvme_ctrl_lookup_subsystem_name(name); if (!subsys_name) { nvme_msg(LOG_ERR, "Failed to lookup subsystem name for %s\n", c->name); -- 2.50.1