Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp1443617ybi; Sat, 25 May 2019 02:05:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqw/N/BKheePro4xEsDR5X55/18vY7dmbHMCCSPgU68yU3Q7sr3gIw6NL+nYSg94xKrqEa5I X-Received: by 2002:a63:79c9:: with SMTP id u192mr1310140pgc.406.1558775103550; Sat, 25 May 2019 02:05:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558775103; cv=none; d=google.com; s=arc-20160816; b=w2xW8S/T+i/YI9M0mpB3l+QBdOaWQKJt4sijS+0/yrtbRMe8cROnBNiQj8tvyKJZb5 +6a470JazdTsEtio/2h1UdnlG2vc4XzhOymso1xiIS7BILyfu7cxf3kn1fmNSgOlT5iu CO2Wm08yPyUB/DmqUSHYH/huKnD5MzNeSuoTPKRuEh9qCBfG1vhywM8eJhco6aZP5unH LiPdBXH6fpIBTB7Q3RTI7mc95fJGX6TYzdYca9L7mdVxpyayGF7l3EKyiipospjE9y6h hpiiArB2boc54j7u1XuvJYZgSblCUOx/FKEYlJ/0Q5EMlSihWyh7pV+XsAwera7FjOR/ HhWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:to:from:date:dkim-signature; bh=kl+IMHLNpv3fsUuyOVQXvcaV+YnnSK1PnzziatRKSdU=; b=Qm8m1YhNnBCuU/l3SaYkPtRGjLuUKolC4vWd2Uu3qOYM116qyGmdaHSehpP0ThSj8k uoj1GvnlTlA+jw710ntBgaH6tFNg11irsP6PPriuVQrRunyPneBC9GCR2hZBckxJJYc6 aXJn0MLD+24i0T4x58ImWMc/psxZ9gAm1k4dl2ZRmS7QUe7ui4na32ReKxtq9jx0IEE2 wQEJXcpibw5IKy+qPD7Uy4D2S+GJuvq48Gy2wKpJjT7t86LExFCl42l3z0+fA5BjxcKY BngmsTfj8M9+yIOrMBXYUAwFT4wsA1FrSOzCJZlO+lFgO0N1bykWEqbmsJPKDV4GVNvt 9pMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=qzjThKc0; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g4si7310046plb.188.2019.05.25.02.04.48; Sat, 25 May 2019 02:05:03 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=qzjThKc0; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726793AbfEYJDE (ORCPT + 99 others); Sat, 25 May 2019 05:03:04 -0400 Received: from mail-pl1-f196.google.com ([209.85.214.196]:37326 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726376AbfEYJDE (ORCPT ); Sat, 25 May 2019 05:03:04 -0400 Received: by mail-pl1-f196.google.com with SMTP id p15so5116587pll.4; Sat, 25 May 2019 02:03:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:mime-version:content-disposition :user-agent; bh=kl+IMHLNpv3fsUuyOVQXvcaV+YnnSK1PnzziatRKSdU=; b=qzjThKc0msG/VNYue5lUg77weVA4wGXe2bh1oYAYamfsvjo5GpMpv93rBeFNrG5Fs/ +gJQ4ki6p3oPEkV1eUCmfkxrgYFaWHUHGokZet3Afn+wNxlEDPaU6DCU/HAkZLLtlSn2 SPXtegQSasgBgOuxgwUxdnyKdEG+UNB2jwl63Nj5Za9IYS1KyO0tAYSKe890D9RWsChp Loohhc8tYEpU0fGkdwvyTeDKzDOFkN2BoZwSn14p3mv4OPOdVJHFj+LdvYXN8cC+1gZO 5Ia0Q6BcSdUSdtageD+8sfmy13YvUzCJpmhJP85YgpAeTht3zk3jHD/LzTjozsO3/XgF SGaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:mime-version :content-disposition:user-agent; bh=kl+IMHLNpv3fsUuyOVQXvcaV+YnnSK1PnzziatRKSdU=; b=Xf5r5S6JS7a2nZcXh4OTzXM7BoVVSfsk27/cviIUOiSF7xk33s0dcuR72tfW9KxIoR fYo9aJdFUmj8KzLf/B5EAbo0zZEhisBX/30DSeb2gvjkY+Va4CkRSZXvNLBa+TqDUO5y 3XNIg+D3TejlnDTg06nXjs+R9Tt6QZrNCQM0QKc4z3haNHZpd1b2Q8ly63QwLpmTfcTM 9+tULMyhq0Uw6exrqJQRDudE5vVkP6+2bsg8pdRR717ILxiYbq+D5Qkj2W4pr2gOVIJn fpqHXYh2sllGomydNpTp96j4+5AQZHFTB2ZGYQX7Vlq8DRRyc0va2UJUe3YRECsU5Gau 19hQ== X-Gm-Message-State: APjAAAUIAVI2lE/HSFPFf0zX5sP89RZwejfKR4Yr+2SPGzwx78IF90o+ /60zq3C81o8u1BqD2gl43wk= X-Received: by 2002:a17:902:a70f:: with SMTP id w15mr42169460plq.222.1558774983695; Sat, 25 May 2019 02:03:03 -0700 (PDT) Received: from hari-Inspiron-1545 ([183.83.92.73]) by smtp.gmail.com with ESMTPSA id 140sm9869603pfw.123.2019.05.25.02.02.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 25 May 2019 02:03:03 -0700 (PDT) Date: Sat, 25 May 2019 14:32:57 +0530 From: Hariprasad Kelam To: Alexei Starovoitov , Daniel Borkmann , Martin KaFai Lau , Song Liu , Yonghong Song , "David S. Miller" , Jakub Kicinski , Jesper Dangaard Brouer , John Fastabend , netdev@vger.kernel.org, bpf@vger.kernel.org, linux-kernel@vger.kernel.org, xdp-newbies@vger.kernel.org Subject: [PATCH] libbpf: fix warning PTR_ERR_OR_ZERO can be used Message-ID: <20190525090257.GA12104@hari-Inspiron-1545> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org fix below warning reported by coccicheck /tools/lib/bpf/libbpf.c:3461:1-3: WARNING: PTR_ERR_OR_ZERO can be used Signed-off-by: Hariprasad Kelam --- 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 197b574..33c25b6 100644 --- a/tools/lib/bpf/libbpf.c +++ b/tools/lib/bpf/libbpf.c @@ -3458,9 +3458,7 @@ bpf_object__find_map_by_offset(struct bpf_object *obj, size_t offset) 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, -- 2.7.4