From bc346b77e9b253d7384262e572eaea8234f9dd93 Mon Sep 17 00:00:00 2001 From: Yi Zhang Date: Tue, 27 May 2025 04:37:34 -0400 Subject: [PATCH] nvme: return earlier when we have bdev-ns for smart-log command After the fix, we will exit earlier and get more info when we have bdev-ns for smart-log command: [1] $ nvme smart-log /dev/nvme0n1 smart log: No such device or address [2] $ ./nvme smart-log /dev/nvme0n1 Only character device is allowed Signed-off-by: Yi Zhang --- nvme.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/nvme.c b/nvme.c index 5992335418..56fd88674c 100644 --- a/nvme.c +++ b/nvme.c @@ -564,6 +564,11 @@ static int get_smart_log(int argc, char **argv, struct command *cmd, struct plug if (err) return err; + if (is_blkdev(dev)) { + nvme_show_error("Only character device is allowed"); + return -EINVAL; + } + err = validate_output_format(nvme_cfg.output_format, &flags); if (err < 0) { nvme_show_error("Invalid output format");