On Mon, 17 Sep 2012 17:50:47 -0300, Arnaldo Carvalho de Melo wrote: > From: Arnaldo Carvalho de Melo <[email protected]> > > Replacing the equivalent open coded malloc + memset bits. > > Cc: David Ahern <[email protected]> > Cc: Frederic Weisbecker <[email protected]> > Cc: Jiri Olsa <[email protected]> > Cc: Mike Galbraith <[email protected]> > Cc: Namhyung Kim <[email protected]> > Cc: Paul Mackerras <[email protected]> > Cc: Peter Zijlstra <[email protected]> > Cc: Stephane Eranian <[email protected]> > Cc: Steven Rostedt <[email protected]> > Link: http://lkml.kernel.org/n/[email protected] > Signed-off-by: Arnaldo Carvalho de Melo <[email protected]> > --- > 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 [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/

