From: Hannes Reinecke Date: Wed, 23 Jun 2021 07:43:07 +0000 (+0200) Subject: tree: initialize all lists X-Git-Tag: v1.0-rc0~123^2~1 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=91f8f037879cf32206da7adf321b0295e6620134;p=users%2Fsagi%2Flibnvme.git tree: initialize all lists As otherwise python will crash horribly. Signed-off-by: Hannes Reinecke --- diff --git a/src/nvme/tree.c b/src/nvme/tree.c index f964772d..be710b6e 100644 --- a/src/nvme/tree.c +++ b/src/nvme/tree.c @@ -90,6 +90,7 @@ nvme_root_t nvme_scan_filter(nvme_scan_filter_t f) } list_head_init(&r->hosts); + r->refcount = 1; nvme_scan_topology(r, f); return r; } @@ -276,6 +277,7 @@ struct nvme_subsystem *nvme_lookup_subsystem(struct nvme_host *h, s->refcount = 1; list_head_init(&s->ctrls); list_head_init(&s->namespaces); + list_node_init(&s->entry); list_add(&h->subsystems, &s->entry); h->r->modified = true; return s; @@ -525,6 +527,8 @@ static int nvme_ctrl_scan_path(struct nvme_ctrl *c, char *name) free(grpid); } + list_node_init(&p->nentry); + list_node_init(&p->entry); list_add(&c->paths, &p->entry); return 0;