[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150927203016.GG24007@krava.redhat.com>
Date: Sun, 27 Sep 2015 22:30:16 +0200
From: Jiri Olsa <jolsa@...hat.com>
To: He Kuang <hekuang@...wei.com>
Cc: a.p.zijlstra@...llo.nl, mingo@...hat.com, acme@...nel.org,
jolsa@...nel.org, kan.liang@...el.com, adrian.hunter@...el.com,
wangnan0@...wei.com, pi3orama@....com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 2/4] perf tools: Prompt error message for wrong terms
of hw/sw events
On Fri, Sep 25, 2015 at 11:11:49AM +0000, He Kuang wrote:
SNIP
> --- a/tools/perf/util/parse-events.c
> +++ b/tools/perf/util/parse-events.c
> @@ -656,6 +656,9 @@ do { \
> CHECK_TYPE_VAL(STR);
> break;
> default:
> + err->str = strdup("unknown term");
> + err->idx = term->err_term;
> + err->help = parse_events_formats_error_string(NULL);
> return -EINVAL;
> }
>
> @@ -1875,3 +1878,26 @@ void parse_events_evlist_error(struct parse_events_evlist *data,
> err->str = strdup(str);
> WARN_ONCE(!err->str, "WARNING: failed to allocate error string");
> }
> +
> +char *parse_events_formats_error_string(char *additional_terms)
> +{
> + char *str;
> + static const char *static_terms = "config,config1,config2,name,"
> + "period,freq,branch_type,time,"
> + "call-graph,stack-size\n";
> +
> + /* valid terms */
> + if (additional_terms) {
> + if (!asprintf(&str, "valid terms: %s,%s",
> + additional_terms, static_terms))
> + goto fail;
> + free(additional_terms);
not excited about freeing the additional_terms arg in here,
please state it in the comment above the function
thanks,
jirka
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists