Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1515661

Re: [PATCH] perf thread: cleanup with list_first_entry_or_null()

From Arnaldo Carvalho de Melo <acme@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH] perf thread: cleanup with list_first_entry_or_null()
Date 2016-11-06 05:10 +0100
Message-ID <sAmWl-vg-3@gated-at.bofh.it> (permalink)
References <sgEj7-72M-7@gated-at.bofh.it> <sAm0h-8hX-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Em Sun, Nov 06, 2016 at 12:00:22PM +0900, Masahiro Yamada escreveu:
> Hi maintainers,
> 
> Does this patch look good?

From a quick look it seems ok, I'll try and process it when back home.

- Arnaldo
 
> 2016-09-13 3:29 GMT+09:00 Masahiro Yamada <yamada.masahiro@socionext.com>:
> > The combo of list_empty() check and return list_first_entry()
> > can be replaced with list_first_entry_or_null().
> >
> > Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> > ---
> >
> >  tools/perf/util/thread.c | 5 +----
> >  1 file changed, 1 insertion(+), 4 deletions(-)
> >
> > diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c
> > index 8b10a55..ea951df 100644
> > --- a/tools/perf/util/thread.c
> > +++ b/tools/perf/util/thread.c
> > @@ -107,10 +107,7 @@ void thread__put(struct thread *thread)
> >
> >  struct comm *thread__comm(const struct thread *thread)
> >  {
> > -       if (list_empty(&thread->comm_list))
> > -               return NULL;
> > -
> > -       return list_first_entry(&thread->comm_list, struct comm, list);
> > +       return list_first_entry_or_null(&thread->comm_list, struct comm, list);
> >  }
> >
> >  struct comm *thread__exec_comm(const struct thread *thread)
> > --
> > 1.9.1
> >
> 
> 
> 
> -- 
> Best Regards
> Masahiro Yamada

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Re: [PATCH] perf thread: cleanup with list_first_entry_or_null() Masahiro Yamada <yamada.masahiro@socionext.com> - 2016-11-06 04:10 +0100
  Re: [PATCH] perf thread: cleanup with list_first_entry_or_null() Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-11-06 05:10 +0100

csiph-web