From: chengjike Date: Thu, 9 Sep 2021 14:57:09 +0000 (+0800) Subject: fix path->nentry bugs X-Git-Tag: v1.0-rc0~106 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=76c8f69d001572fe9319e506d53c0d69691b43ac;p=users%2Fsagi%2Flibnvme.git fix path->nentry bugs The "path->nentry" is initialized after it is added to the list in "nvme_subsystem_set_path_ns" function. Signed-off-by: chengjike --- diff --git a/src/nvme/tree.c b/src/nvme/tree.c index 49815dba..293b0c0a 100644 --- a/src/nvme/tree.c +++ b/src/nvme/tree.c @@ -534,7 +534,6 @@ static int nvme_ctrl_scan_path(struct nvme_ctrl *c, char *name) p->name = strdup(name); p->sysfs_dir = path; p->ana_state = nvme_get_path_attr(p, "ana_state"); - nvme_subsystem_set_path_ns(c->s, p); grpid = nvme_get_path_attr(p, "ana_grpid"); if (grpid) { @@ -543,6 +542,7 @@ static int nvme_ctrl_scan_path(struct nvme_ctrl *c, char *name) } list_node_init(&p->nentry); + nvme_subsystem_set_path_ns(c->s, p); list_node_init(&p->entry); list_add(&c->paths, &p->entry); return 0;