Skip to content

Commit 94fdea3

Browse files
committed
nvme: output nvme_alloc_huge() error message
Currently only the value -ENOMEM returned for the error. Signed-off-by: Tokunori Ikegami <[email protected]>
1 parent 438304a commit 94fdea3

1 file changed

Lines changed: 15 additions & 5 deletions

File tree

nvme.c

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1626,8 +1626,10 @@ static int get_persistent_event_log(int argc, char **argv,
16261626
cfg.action = NVME_PEVENT_LOG_READ;
16271627

16281628
pevent_log_info = nvme_alloc_huge(cfg.log_len, &mh);
1629-
if (!pevent_log_info)
1629+
if (!pevent_log_info) {
1630+
nvme_show_error("failed to allocate huge memory");
16301631
return -ENOMEM;
1632+
}
16311633

16321634
err = nvme_cli_get_log_persistent_event(dev, cfg.action,
16331635
cfg.log_len, pevent_log_info);
@@ -5127,8 +5129,10 @@ static int fw_download(int argc, char **argv, struct command *cmd, struct plugin
51275129
fw_size, cfg.xfer);
51285130

51295131
fw_buf = nvme_alloc_huge(fw_size, &mh);
5130-
if (!fw_buf)
5132+
if (!fw_buf) {
5133+
nvme_show_error("failed to allocate huge memory");
51315134
return -ENOMEM;
5135+
}
51325136

51335137
if (read(fw_fd, fw_buf, fw_size) != ((ssize_t)(fw_size))) {
51345138
err = -errno;
@@ -8260,8 +8264,10 @@ static int submit_io(int opcode, char *command, const char *desc, int argc, char
82608264
}
82618265

82628266
buffer = nvme_alloc_huge(buffer_size, &mh);
8263-
if (!buffer)
8267+
if (!buffer) {
8268+
nvme_show_error("failed to allocate huge memory");
82648269
return -ENOMEM;
8270+
}
82658271

82668272
if (cfg.metadata_size) {
82678273
mbuffer_size = ((unsigned long long)cfg.block_count + 1) * ms;
@@ -9172,8 +9178,10 @@ static int passthru(int argc, char **argv, bool admin,
91729178

91739179
if (cfg.data_len) {
91749180
data = nvme_alloc_huge(cfg.data_len, &mh);
9175-
if (!data)
9181+
if (!data) {
9182+
nvme_show_error("failed to allocate huge memory");
91769183
return -ENOMEM;
9184+
}
91779185

91789186
memset(data, cfg.prefill, cfg.data_len);
91799187
if (!cfg.read && !cfg.write) {
@@ -10214,8 +10222,10 @@ static int nvme_mi(int argc, char **argv, __u8 admin_opcode, const char *desc)
1021410222

1021510223
if (cfg.data_len) {
1021610224
data = nvme_alloc_huge(cfg.data_len, &mh);
10217-
if (!data)
10225+
if (!data) {
10226+
nvme_show_error("failed to allocate huge memory");
1021810227
return -ENOMEM;
10228+
}
1021910229

1022010230
if (send) {
1022110231
if (read(fd, data, cfg.data_len) < 0) {

0 commit comments

Comments
 (0)