Skip to content

Commit 79bb406

Browse files
ikegami-tigaw
authored andcommitted
nvme: use new error handling helper for get-feature error handling
Use nvme_show_err instead of nvme_show_status and nvme_show_error. Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
1 parent 2020756 commit 79bb406

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

nvme.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4838,19 +4838,19 @@ static int filter_out_flags(int status)
48384838
static void get_feature_id_print(struct feat_cfg cfg, int err, __u64 result,
48394839
void *buf, nvme_print_flags_t flags)
48404840
{
4841-
int status = filter_out_flags(err);
4841+
int status = err > 0 ? filter_out_flags(err) : err;
48424842
enum nvme_status_type type = NVME_STATUS_TYPE_NVME;
48434843

4844-
if (!err) {
4845-
nvme_show_feature(cfg.feature_id, cfg.sel, result, buf,
4846-
cfg.data_len, flags);
4847-
} else if (err > 0) {
4848-
if (!nvme_status_equals(status, type, NVME_SC_INVALID_FIELD) &&
4849-
!nvme_status_equals(status, type, NVME_SC_INVALID_NS))
4850-
nvme_show_status(err);
4851-
} else {
4852-
nvme_show_error("get-feature: %s", libnvme_strerror(err));
4844+
if (err) {
4845+
if (nvme_status_equals(status, type, NVME_SC_INVALID_FIELD) ||
4846+
nvme_status_equals(status, type, NVME_SC_INVALID_NS))
4847+
return;
4848+
nvme_show_err(err, "get-feature");
4849+
return;
48534850
}
4851+
4852+
nvme_show_feature(cfg.feature_id, cfg.sel, result, buf, cfg.data_len,
4853+
flags);
48544854
}
48554855

48564856
static bool is_get_feature_result_set(enum nvme_features_id feature_id)

0 commit comments

Comments
 (0)