aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2022-04-28 15:10:48 -0700
committerVishal Verma <vishal.l.verma@intel.com>2022-06-15 16:28:51 -0600
commite32631009a97e4cb72e4afb8eec09f89c3317eb9 (patch)
tree26a4dcccced5b3efcf9e2684c3336e70d2bb725f
parentcf0e0586bf45fd7e4ab17ce2b234bf68995daca3 (diff)
cxl/port: Relax port identifier validation
Now that util_cxl_port_filter() accepts port host identifiers it is no longer possible to pre-validate that the port arguments follow the "port%d" format. Instead, let all inputs through and warn if the filter fails to identify a port. Link: https://lore.kernel.org/r/165118384845.1676208.7570620216888371408.stgit@dwillia2-desk3.amr.corp.intel.com Signed-off-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
-rw-r--r--cxl/port.c30
1 files changed, 4 insertions, 26 deletions
diff --git a/cxl/port.c b/cxl/port.c
index 46a8f32d..89f3916d 100644
--- a/cxl/port.c
+++ b/cxl/port.c
@@ -145,7 +145,6 @@ static int port_action(int argc, const char **argv, struct cxl_ctx *ctx,
usage,
NULL
};
- unsigned long id;
log_init(&pl, "cxl port", "CXL_PORT_LOG");
argc = parse_options(argc, argv, options, u, 0);
@@ -153,31 +152,10 @@ static int port_action(int argc, const char **argv, struct cxl_ctx *ctx,
if (argc == 0)
usage_with_options(u, options);
for (i = 0; i < argc; i++) {
- const char *fmt;
-
if (strcmp(argv[i], "all") == 0) {
argc = 1;
break;
}
-
- if (param.endpoint)
- fmt = "endpoint%lu";
- else
- fmt = "port%lu";
-
- if (sscanf(argv[i], fmt, &id) == 1)
- continue;
- if (sscanf(argv[i], "%lu", &id) == 1)
- continue;
-
- log_err(&pl, "'%s' is not a valid %s identifer\n", argv[i],
- param.endpoint ? "endpoint" : "port");
- err++;
- }
-
- if (err == argc) {
- usage_with_options(u, options);
- return -EINVAL;
}
if (param.debug) {
@@ -187,7 +165,6 @@ static int port_action(int argc, const char **argv, struct cxl_ctx *ctx,
pl.log_priority = LOG_INFO;
rc = 0;
- err = 0;
count = 0;
for (i = 0; i < argc; i++) {
@@ -198,15 +175,16 @@ static int port_action(int argc, const char **argv, struct cxl_ctx *ctx,
endpoint = find_cxl_endpoint(ctx, argv[i]);
if (!endpoint) {
- log_dbg(&pl, "endpoint: %s not found\n",
- argv[i]);
+ log_notice(&pl, "endpoint: %s not found\n",
+ argv[i]);
continue;
}
port = cxl_endpoint_get_port(endpoint);
} else {
port = find_cxl_port(ctx, argv[i]);
if (!port) {
- log_dbg(&pl, "port: %s not found\n", argv[i]);
+ log_notice(&pl, "port: %s not found\n",
+ argv[i]);
continue;
}
}