Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp263388imm; Tue, 31 Jul 2018 18:19:56 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdVgobLEcI+u5idUc3H8MDZdSjfTIpcoe6J1Xs3XtYyY/Nyki8wwKoj3MrzhgBGjWBtN44u X-Received: by 2002:a17:902:758c:: with SMTP id j12-v6mr22571465pll.195.1533086396361; Tue, 31 Jul 2018 18:19:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533086396; cv=none; d=google.com; s=arc-20160816; b=xogijMOb/4Q6aAGQQT575bEzdQfZxQTpfRL7/+eoVqAyA8wo9Qw6kNpmJYTeqN/CP3 xwyI0TLuoYosQrcAXoc3gvJIy3A4Iw/rRvqOPcG5726j1ymqAIsZ3KithzF4/nsE1weQ nNRZMBzxzUq61tDVaNcQrSXT3V3Fsvvc18R6MVIykitOcWTfLhJ/msmqmjrb3H6qR91x kWnjqeFSj+Z2NoeAWCWn9ziVLnmvAcGCO5+e2a2cCbqNHAu+vJoS3UJm4ManSn/7HI3c 0yPU/BZUUqg6Thhi3ALmAskeomRH9oQH6v5aMMS6EfzyvbZoTdA9A4FIKSgjYacUF5g4 jvBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :references:subject:cc:to:mime-version:user-agent:from:date :message-id:arc-authentication-results; bh=Z6Xo3Y+GcnrLLpj28VyR3XbooBgyQvzGSHE7tUJwKjQ=; b=AeXb4OQxjGzH7s7JNwGLbcv7SUS1TffN28RcYhQCuzF8g4a6VFw90RftTsbI8UUWWd LRjLEB4ENjuQzYDiifIHsrdbQr/JJypA53zouAuhCDJtsw8uVZviwAIZKYEpBUiCtwEH xEalE1OSM9U6mae24et21nJr8fudj5pjWhKZxPP2eoniLH2+X4PJDGk7+JZjVpt0UUYq 6ZtMcfSdYn8A6mh7FxNpZJ0g0xQH7GVAS3rriWtSEkLgHflQgAbVTmrZvCalX07bMs8L 4mE2LkZXKx/w/zSzCilDorGQ3/SwmIjWWAdA7BeQGKmpFMP/ps8H/eKvUG4A3niYIZQP 02OA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v11-v6si14734177pgo.278.2018.07.31.18.19.41; Tue, 31 Jul 2018 18:19:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732949AbeHADBy (ORCPT + 99 others); Tue, 31 Jul 2018 23:01:54 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:10194 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1732906AbeHADBy (ORCPT ); Tue, 31 Jul 2018 23:01:54 -0400 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id F0D15F76B2524; Wed, 1 Aug 2018 09:18:49 +0800 (CST) Received: from [127.0.0.1] (10.177.29.68) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.399.0; Wed, 1 Aug 2018 09:18:49 +0800 Message-ID: <5B610A7A.5000909@huawei.com> Date: Wed, 1 Aug 2018 09:18:50 +0800 From: zhong jiang User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 MIME-Version: 1.0 To: , , CC: , Subject: Re: [PATCH] lib/bpf/libbpf: Simplify the code by using PTR_ERR_OR_ZERO References: <1533054656-36134-1-git-send-email-zhongjiang@huawei.com> In-Reply-To: <1533054656-36134-1-git-send-email-zhongjiang@huawei.com> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.29.68] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018/8/1 0:30, zhong jiang wrote: > Use PTR_ERR_OR_ZERO is better than the open code. > > Signed-off-by: zhong jiang > --- > tools/lib/bpf/libbpf.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c > index 40211b5..9b61468 100644 > --- a/tools/lib/bpf/libbpf.c > +++ b/tools/lib/bpf/libbpf.c > @@ -2271,9 +2271,7 @@ struct bpf_map * > > long libbpf_get_error(const void *ptr) > { > - if (IS_ERR(ptr)) > - return PTR_ERR(ptr); > - return 0; > + return PTR_ERR_OR_ZERO(ptr); > } > > int bpf_prog_load(const char *file, enum bpf_prog_type type, I am so sorry for that. I will repost it after check it correct carefully. Thanks zhong jiang