Re: [PATCH]Perf: Return error code for perf_session__new function on failure
From: Jiri Olsa
Date: Thu Aug 15 2019 - 08:51:21 EST
On Wed, Aug 14, 2019 at 03:02:18PM +0530, Mamatha Inamdar wrote:
SNIP
> symbol_conf.pid_list_str = strdup(trace->opts.target.pid);
> diff --git a/tools/perf/util/data-convert-bt.c b/tools/perf/util/data-convert-bt.c
> index ddbcd59..dbc6dc2 100644
> --- a/tools/perf/util/data-convert-bt.c
> +++ b/tools/perf/util/data-convert-bt.c
> @@ -1619,8 +1619,10 @@ int bt_convert__perf2ctf(const char *input, const char *path,
> err = -1;
> /* perf.data session */
> session = perf_session__new(&data, 0, &c.tool);
> - if (!session)
> + if (IS_ERR(session)) {
> + err = PTR_ERR(session);
> goto free_writer;
> + }
>
> if (c.queue_size) {
> ordered_events__set_alloc_size(&session->ordered_events,
I'm getting:
CC util/data-convert-bt.o
util/data-convert-bt.c: In function âbt_convert__perf2ctfâ:
util/data-convert-bt.c:1622:6: error: implicit declaration of function âIS_ERRâ; did you mean âSIG_ERRâ? [-Werror=implicit-function-declaration]
1622 | if (IS_ERR(session)) {
| ^~~~~~
| SIG_ERR
util/data-convert-bt.c:1622:6: error: nested extern declaration of âIS_ERRâ [-Werror=nested-externs]
util/data-convert-bt.c:1623:9: error: implicit declaration of function âPTR_ERRâ [-Werror=implicit-function-declaration]
1623 | err = PTR_ERR(session);
jirka