linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@infradead.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org, Namhyung Kim <namhyung@kernel.org>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung.kim@lge.com>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Steven Rostedt <rostedt@goodmis.org>,
	Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 06/13] tools lib traceevent: Get rid of malloc_or_die() in trace_seq_init()
Date: Wed, 15 Jan 2014 17:33:04 -0300	[thread overview]
Message-ID: <1389817991-8145-7-git-send-email-acme@infradead.org> (raw)
In-Reply-To: <1389817991-8145-1-git-send-email-acme@infradead.org>

From: Namhyung Kim <namhyung@kernel.org>

Use plain malloc() and check its return value.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Reviewed-by: Jiri Olsa <jolsa@redhat.com>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung.kim@lge.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1389750340-15965-4-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/lib/traceevent/trace-seq.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/tools/lib/traceevent/trace-seq.c b/tools/lib/traceevent/trace-seq.c
index e454a2c66cac..ec3bd16a5488 100644
--- a/tools/lib/traceevent/trace-seq.c
+++ b/tools/lib/traceevent/trace-seq.c
@@ -57,8 +57,11 @@ void trace_seq_init(struct trace_seq *s)
 	s->len = 0;
 	s->readpos = 0;
 	s->buffer_size = TRACE_SEQ_BUF_SIZE;
-	s->buffer = malloc_or_die(s->buffer_size);
-	s->state = TRACE_SEQ__GOOD;
+	s->buffer = malloc(s->buffer_size);
+	if (s->buffer != NULL)
+		s->state = TRACE_SEQ__GOOD;
+	else
+		s->state = TRACE_SEQ__MEM_ALLOC_FAILED;
 }
 
 /**
-- 
1.8.1.4


  parent reply	other threads:[~2014-01-15 20:37 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-15 20:32 [GIT PULL 00/13] perf/core improvements and fixes Arnaldo Carvalho de Melo
2014-01-15 20:32 ` [PATCH 01/13] perf record: Rename --no-delay to --no-buffering Arnaldo Carvalho de Melo
2014-01-15 20:33 ` [PATCH 02/13] perf record: Rename --initial-delay to --delay Arnaldo Carvalho de Melo
2014-01-15 20:33 ` [PATCH 03/13] perf tools: Fix build error due to zfree() cast Arnaldo Carvalho de Melo
2014-01-15 20:33 ` [PATCH 04/13] tools lib traceevent: Add state member to struct trace_seq Arnaldo Carvalho de Melo
2014-01-15 20:33 ` [PATCH 05/13] tools lib traceevent: Check return value of realloc() Arnaldo Carvalho de Melo
2014-01-15 20:33 ` Arnaldo Carvalho de Melo [this message]
2014-01-15 20:33 ` [PATCH 07/13] tools lib traceevent: Get rid of die() finally!! Arnaldo Carvalho de Melo
2014-01-15 21:17   ` Steven Rostedt
2014-01-16  8:33     ` Ingo Molnar
2014-01-15 20:33 ` [PATCH 08/13] tools lib traceevent: Make plugin unload function receive pevent Arnaldo Carvalho de Melo
2014-01-15 20:33 ` [PATCH 09/13] perf: tools: Fix cross building Arnaldo Carvalho de Melo
2014-01-15 20:33 ` [PATCH 10/13] perf tools: Remove symbol_conf.use_callchain check Arnaldo Carvalho de Melo
2014-01-15 20:33 ` [PATCH 11/13] perf tools: Factor out sample__resolve_callchain() Arnaldo Carvalho de Melo
2014-01-15 20:33 ` [PATCH 12/13] perf hists: Convert hist entry functions to use struct he_stat Arnaldo Carvalho de Melo
2014-01-15 20:33 ` [PATCH 13/13] tools lib traceevent: fix pointer-integer size mismatch Arnaldo Carvalho de Melo
2014-01-16  8:36 ` [GIT PULL 00/13] perf/core improvements and fixes Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1389817991-8145-7-git-send-email-acme@infradead.org \
    --to=acme@infradead.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@redhat.com \
    --cc=fweisbec@gmail.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung.kim@lge.com \
    --cc=namhyung@kernel.org \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).