* [PATCH] tools lib traceevent: Replace malloc_or_die to plain malloc in alloc_event()
@ 2012-06-11 6:28 Namhyung Kim
2012-06-13 5:48 ` Namhyung Kim
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Namhyung Kim @ 2012-06-11 6:28 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Peter Zijlstra, Paul Mackerras, Ingo Molnar, LKML, Namhyung Kim,
Frederic Weisbecker, Steven Rostedt
From: Namhyung Kim <namhyung.kim@lge.com>
Because the only caller of the alloc_event()
(pevent_parse_event) checks return value properly,
it can be changed to use plain malloc.
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/lib/traceevent/event-parse.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
index c471075e4974..a6b5bcdc5580 100644
--- a/tools/lib/traceevent/event-parse.c
+++ b/tools/lib/traceevent/event-parse.c
@@ -621,7 +621,9 @@ static struct event_format *alloc_event(void)
{
struct event_format *event;
- event = malloc_or_die(sizeof(*event));
+ event = malloc(sizeof(*event));
+ if (!event)
+ return NULL;
memset(event, 0, sizeof(*event));
return event;
--
1.7.10.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] tools lib traceevent: Replace malloc_or_die to plain malloc in alloc_event()
2012-06-11 6:28 [PATCH] tools lib traceevent: Replace malloc_or_die to plain malloc in alloc_event() Namhyung Kim
@ 2012-06-13 5:48 ` Namhyung Kim
2012-06-15 3:30 ` Steven Rostedt
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Namhyung Kim @ 2012-06-13 5:48 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Steven Rostedt
Cc: Peter Zijlstra, Paul Mackerras, Ingo Molnar, LKML, Namhyung Kim,
Frederic Weisbecker
Hi, Steve
Could you take a look at this too?
On Mon, 11 Jun 2012 15:28:53 +0900, Namhyung Kim wrote:
> From: Namhyung Kim <namhyung.kim@lge.com>
>
> Because the only caller of the alloc_event()
> (pevent_parse_event) checks return value properly,
> it can be changed to use plain malloc.
>
> Cc: Frederic Weisbecker <fweisbec@gmail.com>
> Cc: Steven Rostedt <rostedt@goodmis.org>
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> ---
> tools/lib/traceevent/event-parse.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
> index c471075e4974..a6b5bcdc5580 100644
> --- a/tools/lib/traceevent/event-parse.c
> +++ b/tools/lib/traceevent/event-parse.c
> @@ -621,7 +621,9 @@ static struct event_format *alloc_event(void)
> {
> struct event_format *event;
>
> - event = malloc_or_die(sizeof(*event));
> + event = malloc(sizeof(*event));
> + if (!event)
> + return NULL;
> memset(event, 0, sizeof(*event));
>
> return event;
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] tools lib traceevent: Replace malloc_or_die to plain malloc in alloc_event()
2012-06-11 6:28 [PATCH] tools lib traceevent: Replace malloc_or_die to plain malloc in alloc_event() Namhyung Kim
2012-06-13 5:48 ` Namhyung Kim
@ 2012-06-15 3:30 ` Steven Rostedt
2012-06-15 8:45 ` Namhyung Kim
2012-06-28 16:24 ` Arnaldo Carvalho de Melo
2012-07-06 10:56 ` [tip:perf/core] " tip-bot for Namhyung Kim
3 siblings, 1 reply; 6+ messages in thread
From: Steven Rostedt @ 2012-06-15 3:30 UTC (permalink / raw)
To: Namhyung Kim
Cc: Arnaldo Carvalho de Melo, Peter Zijlstra, Paul Mackerras,
Ingo Molnar, LKML, Namhyung Kim, Frederic Weisbecker
On Mon, 2012-06-11 at 15:28 +0900, Namhyung Kim wrote:
> From: Namhyung Kim <namhyung.kim@lge.com>
>
> Because the only caller of the alloc_event()
> (pevent_parse_event) checks return value properly,
> it can be changed to use plain malloc.
>
> Cc: Frederic Weisbecker <fweisbec@gmail.com>
> Cc: Steven Rostedt <rostedt@goodmis.org>
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> ---
> tools/lib/traceevent/event-parse.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
> index c471075e4974..a6b5bcdc5580 100644
> --- a/tools/lib/traceevent/event-parse.c
> +++ b/tools/lib/traceevent/event-parse.c
> @@ -621,7 +621,9 @@ static struct event_format *alloc_event(void)
> {
> struct event_format *event;
>
> - event = malloc_or_die(sizeof(*event));
> + event = malloc(sizeof(*event));
> + if (!event)
> + return NULL;
> memset(event, 0, sizeof(*event));
Perhaps we should combined these to:
{
struct event_format *event;
event = calloc(1, sizeof(*event));
return event;
}
Or even:
{
return calloc(1, sizeof(struct event_format));
}
-- Steve
>
> return event;
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] tools lib traceevent: Replace malloc_or_die to plain malloc in alloc_event()
2012-06-15 3:30 ` Steven Rostedt
@ 2012-06-15 8:45 ` Namhyung Kim
0 siblings, 0 replies; 6+ messages in thread
From: Namhyung Kim @ 2012-06-15 8:45 UTC (permalink / raw)
To: Steven Rostedt
Cc: Arnaldo Carvalho de Melo, Peter Zijlstra, Paul Mackerras,
Ingo Molnar, LKML, Namhyung Kim, Frederic Weisbecker
Hi,
On Thu, 14 Jun 2012 23:30:57 -0400, Steven Rostedt wrote:
> On Mon, 2012-06-11 at 15:28 +0900, Namhyung Kim wrote:
>> From: Namhyung Kim <namhyung.kim@lge.com>
>>
>> Because the only caller of the alloc_event()
>> (pevent_parse_event) checks return value properly,
>> it can be changed to use plain malloc.
>>
>> Cc: Frederic Weisbecker <fweisbec@gmail.com>
>> Cc: Steven Rostedt <rostedt@goodmis.org>
>> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
>> ---
>> tools/lib/traceevent/event-parse.c | 4 +++-
>> 1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
>> index c471075e4974..a6b5bcdc5580 100644
>> --- a/tools/lib/traceevent/event-parse.c
>> +++ b/tools/lib/traceevent/event-parse.c
>> @@ -621,7 +621,9 @@ static struct event_format *alloc_event(void)
>> {
>> struct event_format *event;
>>
>> - event = malloc_or_die(sizeof(*event));
>> + event = malloc(sizeof(*event));
>> + if (!event)
>> + return NULL;
>> memset(event, 0, sizeof(*event));
>
> Perhaps we should combined these to:
>
> {
> struct event_format *event;
>
> event = calloc(1, sizeof(*event));
> return event;
> }
>
> Or even:
>
> {
> return calloc(1, sizeof(struct event_format));
> }
>
Ok, I'll take this. Thanks.
Namhyung
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] tools lib traceevent: Replace malloc_or_die to plain malloc in alloc_event()
2012-06-11 6:28 [PATCH] tools lib traceevent: Replace malloc_or_die to plain malloc in alloc_event() Namhyung Kim
2012-06-13 5:48 ` Namhyung Kim
2012-06-15 3:30 ` Steven Rostedt
@ 2012-06-28 16:24 ` Arnaldo Carvalho de Melo
2012-07-06 10:56 ` [tip:perf/core] " tip-bot for Namhyung Kim
3 siblings, 0 replies; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-06-28 16:24 UTC (permalink / raw)
To: Namhyung Kim
Cc: Peter Zijlstra, Paul Mackerras, Ingo Molnar, LKML, Namhyung Kim,
Frederic Weisbecker, Steven Rostedt
Em Mon, Jun 11, 2012 at 03:28:53PM +0900, Namhyung Kim escreveu:
> From: Namhyung Kim <namhyung.kim@lge.com>
>
> Because the only caller of the alloc_event()
> (pevent_parse_event) checks return value properly,
> it can be changed to use plain malloc.
Thanks, applied to perf/core.
- Arnaldo
^ permalink raw reply [flat|nested] 6+ messages in thread
* [tip:perf/core] tools lib traceevent: Replace malloc_or_die to plain malloc in alloc_event()
2012-06-11 6:28 [PATCH] tools lib traceevent: Replace malloc_or_die to plain malloc in alloc_event() Namhyung Kim
` (2 preceding siblings ...)
2012-06-28 16:24 ` Arnaldo Carvalho de Melo
@ 2012-07-06 10:56 ` tip-bot for Namhyung Kim
3 siblings, 0 replies; 6+ messages in thread
From: tip-bot for Namhyung Kim @ 2012-07-06 10:56 UTC (permalink / raw)
To: linux-tip-commits
Cc: acme, linux-kernel, paulus, hpa, mingo, a.p.zijlstra,
namhyung.kim, namhyung, fweisbec, rostedt, tglx
Commit-ID: 50d8f9e393c5a1a8864fda75e3a9f2b800497a61
Gitweb: http://git.kernel.org/tip/50d8f9e393c5a1a8864fda75e3a9f2b800497a61
Author: Namhyung Kim <namhyung.kim@lge.com>
AuthorDate: Mon, 11 Jun 2012 15:28:53 +0900
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Fri, 29 Jun 2012 13:28:13 -0300
tools lib traceevent: Replace malloc_or_die to plain malloc in alloc_event()
Because the only caller of the alloc_event() (pevent_parse_event) checks
return value properly, it can be changed to use plain malloc.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1339396133-9839-1-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/lib/traceevent/event-parse.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
index b1abd39..83f0a8a 100644
--- a/tools/lib/traceevent/event-parse.c
+++ b/tools/lib/traceevent/event-parse.c
@@ -616,7 +616,9 @@ static struct event_format *alloc_event(void)
{
struct event_format *event;
- event = malloc_or_die(sizeof(*event));
+ event = malloc(sizeof(*event));
+ if (!event)
+ return NULL;
memset(event, 0, sizeof(*event));
return event;
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-07-06 10:56 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-11 6:28 [PATCH] tools lib traceevent: Replace malloc_or_die to plain malloc in alloc_event() Namhyung Kim
2012-06-13 5:48 ` Namhyung Kim
2012-06-15 3:30 ` Steven Rostedt
2012-06-15 8:45 ` Namhyung Kim
2012-06-28 16:24 ` Arnaldo Carvalho de Melo
2012-07-06 10:56 ` [tip:perf/core] " tip-bot for Namhyung Kim
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox