On Mon, 17 Sep 2012 17:50:47 -0300, Arnaldo Carvalho de Melo wrote: > From: Arnaldo Carvalho de Melo <a...@redhat.com> > > Replacing the equivalent open coded malloc + memset bits. > > Cc: David Ahern <dsah...@gmail.com> > Cc: Frederic Weisbecker <fweis...@gmail.com> > Cc: Jiri Olsa <jo...@redhat.com> > Cc: Mike Galbraith <efa...@gmx.de> > Cc: Namhyung Kim <namhy...@gmail.com> > Cc: Paul Mackerras <pau...@samba.org> > Cc: Peter Zijlstra <pet...@infradead.org> > Cc: Stephane Eranian <eran...@google.com> > Cc: Steven Rostedt <rost...@goodmis.org> > Link: http://lkml.kernel.org/n/tip-598fjtjbzal4wxh7fp0yv...@git.kernel.org > Signed-off-by: Arnaldo Carvalho de Melo <a...@redhat.com> > --- > tools/lib/traceevent/event-parse.c | 44 > ++++++++++++------------------------ > 1 file changed, 14 insertions(+), 30 deletions(-) > > diff --git a/tools/lib/traceevent/event-parse.c > b/tools/lib/traceevent/event-parse.c > index 278f989..5e38d2f 100644 > --- a/tools/lib/traceevent/event-parse.c > +++ b/tools/lib/traceevent/event-parse.c > @@ -117,14 +117,7 @@ void breakpoint(void) > > struct print_arg *alloc_arg(void) > { > - struct print_arg *arg; > - > - arg = malloc_or_die(sizeof(*arg)); > - if (!arg) > - return NULL; > - memset(arg, 0, sizeof(*arg)); > - > - return arg; > + return calloc(1, sizeof(struct print_arg)); > }
This requires every callsite of the function should handle allocation failure. Thanks, Namhyung -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/