From: Bart Van Assche Date: Wed, 19 Jun 2019 17:09:54 +0000 (-0700) Subject: nvme-cli: Skip properties that are not supported X-Git-Tag: v1.9~40^2~2 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=14ef3681c6a505efff6d4efcb1d94a6531276a57;p=users%2Fsagi%2Fnvme-cli.git nvme-cli: Skip properties that are not supported Instead of causing the show-regs command to fail if a property is encountered that is not supported by the target side, do not display the property. With this patch applied the following output is displayed for the Linux NVMf target: $ nvme show-regs /dev/nvme0 cap : f0003ff version : 10300 cc : 460001 csts : 1 Signed-off-by: Bart Van Assche --- diff --git a/nvme-ioctl.c b/nvme-ioctl.c index 0c8de074..57fae22e 100644 --- a/nvme-ioctl.c +++ b/nvme-ioctl.c @@ -614,7 +614,10 @@ int nvme_get_properties(int fd, void **pbar) memset(*pbar, 0xff, size); for (offset = NVME_REG_CAP; offset <= NVME_REG_CMBSZ;) { err = nvme_get_property(fd, offset, &value); - if (err) { + if (err > 0 && (err & 0xff) == NVME_SC_INVALID_FIELD) { + err = 0; + value = -1; + } else if (err) { free(*pbar); break; }