From f5b812331db52783292e89192a04195031132c23 Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Fri, 5 Dec 2025 16:17:40 -0700 Subject: [PATCH] nvme: Improve error message for invalid format value Improve the wording of the invalid namespace value. Reword the comment and move a line of code to the block it logically belongs to. No functional changes intended. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D51393 --- sys/dev/nvme/nvme_ns.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/sys/dev/nvme/nvme_ns.c b/sys/dev/nvme/nvme_ns.c index 4ebcc03c4f0..b6611161a2b 100644 --- a/sys/dev/nvme/nvme_ns.c +++ b/sys/dev/nvme/nvme_ns.c @@ -563,16 +563,14 @@ nvme_ns_construct(struct nvme_namespace *ns, uint32_t id, return ((ns->flags & NVME_NS_ADDED) ? 0 : ENXIO); } - flbas_fmt = NVMEV(NVME_NS_DATA_FLBAS_FORMAT, ns->data.flbas); - /* - * Note: format is a 0-based value, so > is appropriate here, - * not >=. + * Check the validity of the format specified. Note: format is a 0-based + * value, so > is appropriate here, not >=. */ + flbas_fmt = NVMEV(NVME_NS_DATA_FLBAS_FORMAT, ns->data.flbas); if (flbas_fmt > ns->data.nlbaf) { - nvme_printf(ctrlr, - "lba format %d exceeds number supported (%d)\n", - flbas_fmt, ns->data.nlbaf + 1); + nvme_printf(ctrlr, "nsid %d lba format %d invalid (> %d)\n", + id, flbas_fmt, ns->data.nlbaf + 1); return (ENXIO); }