Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755250AbbKCPUt (ORCPT ); Tue, 3 Nov 2015 10:20:49 -0500 Received: from mail.kernel.org ([198.145.29.136]:38332 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932357AbbKCPUm (ORCPT ); Tue, 3 Nov 2015 10:20:42 -0500 Date: Tue, 3 Nov 2015 12:20:36 -0300 From: Arnaldo Carvalho de Melo To: Wang Nan Cc: lizefan@huawei.com, pi3orama@163.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/5] perf tools: Parsing libbpf return value using err.h Message-ID: <20151103152036.GP21609@kernel.org> References: <1446547486-229499-1-git-send-email-wangnan0@huawei.com> <1446547486-229499-4-git-send-email-wangnan0@huawei.com> <20151103151716.GO21609@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20151103151716.GO21609@kernel.org> X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1170 Lines: 33 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/