From: Minwoo Im Date: Thu, 18 Jan 2018 09:16:31 +0000 (+0900) Subject: nvme-cli: memblaze: add error return after parse_and_open() X-Git-Tag: v1.6~107^2^2 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=cdba5f4e11fcf3e33db65308ef71857b6264d1ee;p=users%2Fhch%2Fnvme-cli.git nvme-cli: memblaze: add error return after parse_and_open() Add returning error when it fails. Signed-off-by: Minwoo Im --- diff --git a/memblaze-nvme.c b/memblaze-nvme.c index 863c8ff..9c8c52f 100644 --- a/memblaze-nvme.c +++ b/memblaze-nvme.c @@ -222,6 +222,8 @@ static int get_additional_smart_log(int argc, char **argv, struct command *cmd, }; fd = parse_and_open(argc, argv, desc, command_line_options, &cfg, sizeof(cfg)); + if (fd < 0) + return fd; err = nvme_get_log(fd, cfg.namespace_id, 0xca, NVME_NO_LOG_LSP, NVME_NO_LOG_LPO, @@ -301,6 +303,8 @@ static int get_additional_feature(int argc, char **argv, struct command *cmd, st }; fd = parse_and_open(argc, argv, desc, command_line_options, &cfg, sizeof(cfg)); + if (fd < 0) + return fd; if (cfg.sel > 7) { fprintf(stderr, "invalid 'select' param:%d\n", cfg.sel); @@ -394,6 +398,8 @@ static int set_additional_feature(int argc, char **argv, struct command *cmd, st }; fd = parse_and_open(argc, argv, desc, command_line_options, &cfg, sizeof(cfg)); + if (fd < 0) + return fd; if (!cfg.feature_id) { fprintf(stderr, "feature-id required param\n");