Received: by 10.223.164.202 with SMTP id h10csp2305184wrb; Mon, 27 Nov 2017 15:12:50 -0800 (PST) X-Google-Smtp-Source: AGs4zMaDkusJm/gJtOxsQvXNyZtrpWPkVt/LMHdOjAWxjAZ7/PM1yN4naR1lqW0t+P7/UBNDwyi2 X-Received: by 10.84.224.206 with SMTP id k14mr40347777pln.403.1511824370718; Mon, 27 Nov 2017 15:12:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511824370; cv=none; d=google.com; s=arc-20160816; b=MSYWyQb/GwO4bWaZ/1TqfWma3CAZoMi3vaA25tiJRLrWwBwDDs6IMjElLd9u147Nu/ W4rQMdVUo4oniD9STJkSL5QsLExfxwx9wdtoFbulJ5G66GzgeOKuPOIy26vFIkwZZ49A WDbjKOZGQF0+bVAE2IMS4udqPqES7EpA2OWAgs1bKp55jXSRug1dpu78ngl3v6ckkELR d17bdnEurHFWr9DJtQmVmVF08EmCtDAZZviiVyJbIoW2dgVLkezV2if9MLs9VlPNdW4q mpDo9ucAPsRiFwdO3qWNVTTJQJwcli8Gv3MIOHUvzc3y3C3TQWQKnh9REfaOCjFn+l9s NQPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=F84XenyKcKr0IdK/rlTdkCrfK1Qp5ZkVYjWVprAabCM=; b=M1HgUXO1I0iN7oTl7Ixwv3TBviEBgtwR6+vzxENIBIUQclGF81mCWO9RD/ivA399Tk eGwx8PZ6Kx046q18JuU1ITv73NWQjs8O4JkFpdOf5U2s7cTNJfrIlhus6WDPtRrIAdb7 /LaX97S9KRj0mlAQVLcBJqUndtNJWc6GlgrYmj08GGhc62zPrWMNcasxoIvBX0hdvu4v s1fPLs0IuINkZmB1/dtpPYUFN5rNRBKIk6NmVeEWMF93UsikRmS4XDl0cE6nbPxInpZy 9yJFoI55nkkbri7xBEveCLh1LldOoOXLKJkjkonhFcKt185AfwEQV7fjuzou6EzbgSLu a0SA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=nUAqx/vF; 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=NONE 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 t10si12849191plh.762.2017.11.27.15.12.39; Mon, 27 Nov 2017 15:12:50 -0800 (PST) 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=nUAqx/vF; 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=NONE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753127AbdK0XLy (ORCPT + 78 others); Mon, 27 Nov 2017 18:11:54 -0500 Received: from mail-lf0-f66.google.com ([209.85.215.66]:40892 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752422AbdK0XLw (ORCPT ); Mon, 27 Nov 2017 18:11:52 -0500 Received: by mail-lf0-f66.google.com with SMTP id d10so23696606lfj.7 for ; Mon, 27 Nov 2017 15:11:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=F84XenyKcKr0IdK/rlTdkCrfK1Qp5ZkVYjWVprAabCM=; b=nUAqx/vFFmgFY9/lUgbmTpQwHie0xmdf49AYkDLdee2nbWTNWDj8rE5fefudpspgzi N3rANWreL9YEP8EWmraS2GvVy0l57LRslU/BB0Pc26a1n/K/E1HnlqiYWPTR5k0pJS0P tS+RRypzwrVjHSfi6x3hiX+yUEl6xee/2bApVyhBm2kfWJcyo30tExzK8HvCSy7sePeS 8BEbzBG3oPemFA95QU6VDTaT/vjL1n/yx0JyFtwEDja7ZhD22+fcP+GPXhez52wgCHpN +5BZBai2bkkd+WfFtaSbUXwG/DVaGOPaPzrEwoGvWMC02zFwjf/FjeO5BqQxxmkedX0a lz2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=F84XenyKcKr0IdK/rlTdkCrfK1Qp5ZkVYjWVprAabCM=; b=VLSU8MS7K039sFu8nXSjp0SxgjPXziUvZYkZKxzKfePnOo77/WpJgU/kEfmU9zSMh5 p3c9r+kSHbk21uKgm/wRYTldmsJXKWCoq/9AP3pZHsCvubtzGqiZzJbl02gUlSuawx72 1H/mM5IOu74+OjDaA5XcGe8fzYCjOfdgrJ0SF3hyqMeZBMgNaAbdViIryCxAf6eXB1Ax 9D4pncQ9fJ5NohDl+1yBOYPbvs7jziQmiGBXtuya8LkzW9a4rYmWg5RuxCWsMhAUQOfB b1oDw7gxWkRqfakQL9lsUYiy6dW9jd5HDdrWJaiilGjTzwXbGbSZbTOEnW8K4V2H/QPX b1Hg== X-Gm-Message-State: AJaThX7iQETwlBPhyZ5/4OMptMEuNGa96NIEIAoU+4gizpGaU61iObog zkX/+VX0w8d0VM/7Nf4905Y= X-Received: by 10.46.19.10 with SMTP id 10mr5007672ljt.181.1511824311486; Mon, 27 Nov 2017 15:11:51 -0800 (PST) Received: from localhost.localdomain ([195.254.138.66]) by smtp.gmail.com with ESMTPSA id z68sm5604879lje.26.2017.11.27.15.11.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 27 Nov 2017 15:11:50 -0800 (PST) From: Vasyl Gomonovych To: acme@redhat.com, joe@ovn.org, wangnan0@huawei.com, ast@fb.com, davem@davemloft.net, john.fastabend@gmail.com Cc: gomonovych@gmail.com, linux-kernel@vger.kernel.org Subject: [PATCH] tools lib bpf: Use PTR_ERR_OR_ZERO() Date: Tue, 28 Nov 2017 00:11:43 +0100 Message-Id: <1511824303-15856-1-git-send-email-gomonovych@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Fix ptr_ret.cocci warnings: tools/lib/bpf/libbpf.c:1744:1-3: WARNING: PTR_ERR_OR_ZERO can be used Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR Generated by: scripts/coccinelle/api/ptr_ret.cocci Signed-off-by: Vasyl Gomonovych --- 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 35f6dfcdc565..c0894ef65631 100644 --- a/tools/lib/bpf/libbpf.c +++ b/tools/lib/bpf/libbpf.c @@ -1741,9 +1741,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, -- 1.9.1 From 1585298418622072632@xxx Tue Nov 28 08:39:45 +0000 2017 X-GM-THRID: 1585274084735365907 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread