From 7f19b6cf5e090c91bcdc7523c6d3054edc5605db Mon Sep 17 00:00:00 2001 From: Hannes Reinecke Date: Fri, 5 Apr 2024 17:04:10 +0200 Subject: [PATCH] ioctl: Return NVMe status in nvme_directive_send_id_endir() Documentation states that the NVMe status code should be returned, to fix up the code to actually do it. Signed-off-by: Hannes Reinecke --- src/nvme/ioctl.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/nvme/ioctl.c b/src/nvme/ioctl.c index ba475496f..4c9a1bced 100644 --- a/src/nvme/ioctl.c +++ b/src/nvme/ioctl.c @@ -1533,6 +1533,8 @@ int nvme_directive_send_id_endir(int fd, __u32 nsid, bool endir, { __u32 cdw12 = NVME_SET(dtype, DIRECTIVE_SEND_IDENTIFY_CDW12_DTYPE) | NVME_SET(endir, DIRECTIVE_SEND_IDENTIFY_CDW12_ENDIR); + __u32 result = 0; + int err; struct nvme_directive_send_args args = { .args_size = sizeof(args), .fd = fd, @@ -1544,10 +1546,13 @@ int nvme_directive_send_id_endir(int fd, __u32 nsid, bool endir, .data_len = sizeof(*id), .data = id, .timeout = NVME_DEFAULT_IOCTL_TIMEOUT, - .result = NULL, + .result = &result, }; - return nvme_directive_send(&args); + err = nvme_directive_send(&args); + if (err && result) + err = result; + return err; } int nvme_directive_recv(struct nvme_directive_recv_args *args)