Commit cdc332d1 authored by Daniel Verkamp's avatar Daniel Verkamp
Browse files

bdev/nvme: fix vendor_id formatting



The printf # specifier adds 0x for %x values, but the field width then
includes the 0x part, so for example printf("%#04x", 0x1) prints "0x01"
rather than the intended "0x0001".

Rather than increasing the field width, just manually insert the 0x in
the format string and drop # for less confusion.

Change-Id: Ie6044619a22b51b39562bfa5c0c0239933bf38c8
Signed-off-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
parent 307d1320
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -358,7 +358,7 @@ blockdev_nvme_dump_config_json(struct spdk_bdev *bdev, struct spdk_json_write_ct
				   nvme_dev->pci_addr.func);

	spdk_json_write_name(w, "vendor_id");
	spdk_json_write_string_fmt(w, "%#04x", cdata->vid);
	spdk_json_write_string_fmt(w, "0x%04x", cdata->vid);

	snprintf(buf, sizeof(cdata->mn) + 1, "%s", cdata->mn);
	spdk_str_trim(buf);