Skip to content

Commit bc346b7

Browse files
committed
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 <[email protected]>
1 parent cba763f commit bc346b7

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

nvme.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,11 @@ static int get_smart_log(int argc, char **argv, struct command *cmd, struct plug
564564
if (err)
565565
return err;
566566

567+
if (is_blkdev(dev)) {
568+
nvme_show_error("Only character device is allowed");
569+
return -EINVAL;
570+
}
571+
567572
err = validate_output_format(nvme_cfg.output_format, &flags);
568573
if (err < 0) {
569574
nvme_show_error("Invalid output format");

0 commit comments

Comments
 (0)