Since array types are handled differently, errors referencing them
also need to be handled differently.  Add and use a new
INVALID_ARRAY_SPEC error.  Also remove INVALID_FIELD since it can
better be handled using CMD_INCOMPLETE, and remove CMD_TOO_LONG, since
it's no longer used.

Signed-off-by: Tom Zanussi <zanu...@kernel.org>
---
 kernel/trace/trace_events_synth.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/kernel/trace/trace_events_synth.c 
b/kernel/trace/trace_events_synth.c
index 2333025ef31e..f48964bdd66e 100644
--- a/kernel/trace/trace_events_synth.c
+++ b/kernel/trace/trace_events_synth.c
@@ -28,8 +28,7 @@
        C(TOO_MANY_FIELDS,      "Too many fields"),             \
        C(INCOMPLETE_TYPE,      "Incomplete type"),             \
        C(INVALID_TYPE,         "Invalid type"),                \
-       C(INVALID_FIELD,        "Invalid field"),               \
-       C(CMD_TOO_LONG,         "Command too long"),
+       C(INVALID_ARRAY_SPEC,   "Invalid array specification"),
 
 #undef C
 #define C(a, b)                SYNTH_ERR_##a
@@ -643,6 +642,10 @@ static struct synth_field *parse_synth_field(int argc, 
const char **argv,
        size = synth_field_size(field->type);
        if (size < 0) {
                synth_err(SYNTH_ERR_INVALID_TYPE, errpos(field_type));
+               if (array)
+                       synth_err(SYNTH_ERR_INVALID_ARRAY_SPEC, 
errpos(field_name));
+               else
+                       synth_err(SYNTH_ERR_INVALID_TYPE, errpos(field_type));
                ret = -EINVAL;
                goto free;
        } else if (size == 0) {
@@ -1191,7 +1194,7 @@ static int __create_synth_event(int argc, const char 
*name, const char **argv)
        }
 
        if (i < argc) {
-               synth_err(SYNTH_ERR_INVALID_FIELD, errpos(argv[i]));
+               synth_err(SYNTH_ERR_CMD_INCOMPLETE, errpos(argv[i]));
                ret = -EINVAL;
                goto err;
        }
-- 
2.17.1

Reply via email to