lkml.org 
[lkml]   [2015]   [Nov]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 3/5] perf tools: Parsing libbpf return value using err.h
Em Tue, Nov 03, 2015 at 12:17:16PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Tue, Nov 03, 2015 at 10:44:44AM +0000, Wang Nan escreveu:
> > +++ b/tools/perf/tests/llvm.c
> > @@ -27,7 +27,7 @@ static int test__bpf_parsing(void *obj_buf, size_t obj_buf_sz)
> > struct bpf_object *obj;

> > obj = bpf_object__open_buffer(obj_buf, obj_buf_sz, NULL);
> > - if (!obj)
> > + if (IS_ERR(obj) || !obj)

> Well, since we've adopted IS_ERR() from the kernel, we better try to
> follow how it is used there, no?

> Since you move to use ERR_PTR(), you probably will never return NULL,
> right? So whay the (|| !obj) part?

> The kernel has an IS_ERR_OR_NULL() interface tho, trying to figure out
> when that would be appropriate...

I think you should change the error reporting convention _and_ the users
at the same time, i.e. please merge this patch with the next and use
plain:

if (IS_ERR(obj))

Instead, ok?

- Arnaldo


\
 
 \ /
  Last update: 2015-11-03 16:41    [W:0.190 / U:0.604 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site