Skip to content

Commit 7bb47ae

Browse files
committed
nvme: Combine duplicated char dev error message string variables
This change is for the maintainability. Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
1 parent e1c0303 commit 7bb47ae

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

nvme.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ static const char *namespace_desired = "desired namespace";
221221
static const char *namespace_id_desired = "identifier of desired namespace";
222222
static const char *namespace_id_optional = "optional namespace attached to controller";
223223
static const char *nssf = "NVMe Security Specific Field";
224+
static const char *only_char_dev = "Only character device is allowed";
224225
static const char *prinfo = "PI and check field";
225226
static const char *rae = "Retain an Asynchronous Event";
226227
static const char *raw_directive = "show directive in binary format";
@@ -5350,7 +5351,7 @@ static int subsystem_reset(int argc, char **argv, struct command *acmd, struct p
53505351
return err;
53515352

53525353
if (!nvme_transport_handle_is_chardev(hdl)) {
5353-
nvme_show_error("Only character device is allowed");
5354+
nvme_show_error(only_char_dev);
53545355
return -EINVAL;
53555356
}
53565357

@@ -5381,7 +5382,7 @@ static int reset(int argc, char **argv, struct command *acmd, struct plugin *plu
53815382
return err;
53825383

53835384
if (!nvme_transport_handle_is_chardev(hdl)) {
5384-
nvme_show_error("Only character device is allowed");
5385+
nvme_show_error(only_char_dev);
53855386
return -EINVAL;
53865387
}
53875388

@@ -5410,7 +5411,7 @@ static int ns_rescan(int argc, char **argv, struct command *acmd, struct plugin
54105411
return err;
54115412

54125413
if (!nvme_transport_handle_is_chardev(hdl)) {
5413-
nvme_show_error("Only character device is allowed");
5414+
nvme_show_error(only_char_dev);
54145415
return -EINVAL;
54155416
}
54165417

@@ -5755,7 +5756,7 @@ static int show_registers(int argc, char **argv, struct command *acmd, struct pl
57555756
return err;
57565757

57575758
if (nvme_transport_handle_is_blkdev(hdl)) {
5758-
nvme_show_error("Only character device is allowed");
5759+
nvme_show_error(only_char_dev);
57595760
return -EINVAL;
57605761
}
57615762

@@ -6032,7 +6033,7 @@ static int get_register(int argc, char **argv, struct command *acmd, struct plug
60326033
return err;
60336034

60346035
if (nvme_transport_handle_is_blkdev(hdl)) {
6035-
nvme_show_error("Only character device is allowed");
6036+
nvme_show_error(only_char_dev);
60366037
return -EINVAL;
60376038
}
60386039

@@ -6336,7 +6337,7 @@ static int set_register(int argc, char **argv, struct command *acmd, struct plug
63366337
return err;
63376338

63386339
if (nvme_transport_handle_is_blkdev(hdl)) {
6339-
nvme_show_error("Only character device is allowed");
6340+
nvme_show_error(only_char_dev);
63406341
return -EINVAL;
63416342
}
63426343

0 commit comments

Comments
 (0)