]> www.infradead.org Git - users/sagi/libnvme.git/commitdiff
ioctl: Return NVMe status in nvme_directive_send_id_endir()
authorHannes Reinecke <hare@suse.de>
Fri, 5 Apr 2024 15:04:10 +0000 (17:04 +0200)
committerDaniel Wagner <wagi@monom.org>
Tue, 9 Apr 2024 12:47:59 +0000 (14:47 +0200)
Documentation states that the NVMe status code should be returned,
to fix up the code to actually do it.

Signed-off-by: Hannes Reinecke <hare@suse.de>
src/nvme/ioctl.c

index ba475496f651f44371950c4a985b2528283894d5..4c9a1bcedf6d51125507123759df02ac0d71cb2f 100644 (file)
@@ -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)