From: Daniel Wagner Date: Fri, 28 Jan 2022 16:58:40 +0000 (+0100) Subject: util: Set errno in error case nvme_get_directive_receive_length X-Git-Tag: v1.0-rc2~4^2 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=efcb5ec7edba4fc3906d8c9c8f82b6dade7e431b;p=users%2Fsagi%2Flibnvme.git util: Set errno in error case nvme_get_directive_receive_length The API says we return -1 in the error case and set the errno accordingly. Update nvme_get_directive_receive_length to fulfill the promise. Signed-off-by: Daniel Wagner --- diff --git a/src/nvme/util.c b/src/nvme/util.c index b3c76205..50c2021a 100644 --- a/src/nvme/util.c +++ b/src/nvme/util.c @@ -470,10 +470,12 @@ int nvme_get_directive_receive_length(enum nvme_directive_dtype dtype, *len = 0; return 0; default: - return -EINVAL; + errno = EINVAL; + return -1; } default: - return -EINVAL; + errno = EINVAL; + return -1; } }