Skip to content

Commit

Permalink
ioctl: Return NVMe status in nvme_directive_send_id_endir()
Browse files Browse the repository at this point in the history
Documentation states that the NVMe status code should be returned,
to fix up the code to actually do it.

Signed-off-by: Hannes Reinecke <[email protected]>
  • Loading branch information
hreinecke committed Apr 5, 2024
1 parent c6888d0 commit 7f19b6c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/nvme/ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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)
Expand Down

0 comments on commit 7f19b6c

Please sign in to comment.