Skip to content

Commit e71d925

Browse files
martin-gpyigaw
authored andcommitted
tree: update nvme_scan_ctrl() return handling
Copilot identified an issue with the return handling of nvme_scan_ctrl() which could potentially display a misleading error message by nvme_strerror(). Fix the same. Signed-off-by: Martin George <[email protected]>
1 parent be824d6 commit e71d925

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

libnvme/src/nvme/tree.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,9 +297,9 @@ int nvme_scan_topology(struct nvme_global_ctx *ctx, nvme_scan_filter_t f, void *
297297
nvme_ctrl_t c;
298298

299299
ret = nvme_scan_ctrl(ctx, ctrls.ents[i]->d_name, &c);
300-
if (!ret) {
300+
if (ret < 0) {
301301
nvme_msg(ctx, LOG_DEBUG, "failed to scan ctrl %s: %s\n",
302-
ctrls.ents[i]->d_name, nvme_strerror(ret));
302+
ctrls.ents[i]->d_name, nvme_strerror(-ret));
303303
continue;
304304
}
305305
}

0 commit comments

Comments
 (0)