From: Jens Axboe Date: Tue, 4 Apr 2023 14:51:31 +0000 (-0600) Subject: engines/nvme: cache errno value X-Git-Tag: fio-3.35~41 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=af10f514b5e8713f0821c34fadfe22c91d137720;p=fio.git engines/nvme: cache errno value It's pretty pointless to do a bunch of things in between getting a -1/errno value, and then expect errno to still be what you want. Signed-off-by: Jens Axboe --- diff --git a/engines/nvme.c b/engines/nvme.c index ac908687..fd2161f3 100644 --- a/engines/nvme.c +++ b/engines/nvme.c @@ -112,9 +112,10 @@ int fio_nvme_get_info(struct fio_file *f, __u32 *nsid, __u32 *lba_sz, namespace_id = ioctl(fd, NVME_IOCTL_ID); if (namespace_id < 0) { + err = -errno; log_err("failed to fetch namespace-id"); close(fd); - return -errno; + return err; } /* @@ -414,6 +415,7 @@ int fio_nvme_iomgmt_ruhs(struct thread_data *td, struct fio_file *f, } else errno = 0; + ret = -errno; close(fd); - return -errno; + return ret; }