Received: by 2002:a4a:301c:0:0:0:0:0 with SMTP id q28-v6csp631882oof; Tue, 25 Sep 2018 02:32:18 -0700 (PDT) X-Google-Smtp-Source: ACcGV61v3+43W/kmxZtI0bE/eAIMrF2anuD3GLq4bb2t+Ss8dnrYpYhyzGmZFf6lisChRSG/7JdA X-Received: by 2002:a17:902:8f8c:: with SMTP id z12-v6mr258986plo.4.1537867938194; Tue, 25 Sep 2018 02:32:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537867938; cv=none; d=google.com; s=arc-20160816; b=f48nJrAKO7ostdYB3YAwBi+a8dgOmZWtGhZZVvsQDqcQUzhlzznBfnH2bxW4ukxDb6 BkFiBu0OLRqpVtuQqJ10HsPC6lydmauAv3bzC2QOOPTYHLGXdY24xVjnRHSCdqAk3mUI rn3F7jGWq4H97J3A/GQUcSM/TMU55U2ucGiIeCStlkgRmU9jweLqpRCJuu97er9ynh0U GCKRr9t0y5X63UQTmzbfaWNtblaIXtPyGVr00w3SKaC3uv5+qgeovdpf1A5tmpSsp3lf ClrdDYRZ+ctd4YSF/oYlX63UVz32KGN4I/bTqTz2Js8LDIueqgGffbDJxrliClk3tIhr kD0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date; bh=+EMFmoHHOfKeFQXEGV3aF2vwSOFjxA1fZTJWHMbvHpk=; b=dw02FMGt4y6Lyz5futiNsMGiRIdqdmEWoesuHVg5d69KZdxDNOxIRwUEWM1rYXdisv kazgLO2Lo0suPix1ZhVmU4UbJ4Q0WqdeaUpABdwTQ3cxpn2wVFbMTypskCKKGVb0P0zb hDKIAZqmKMbN5bR/IrVqgI7ofyjhdt18tJ8Xlpkx+DTKQrm2Q9zPJCC5ypZklnd0kwE5 OXWTZJ3euSLSKnNYcTTlP/1VNr/9AtKr9bsiWOaMYPjk8hnLcElTMDR8GrIIMVfQv17S 1ziaY0w2I73zs7kfnQ+Mlrogz15Z2f5B8WQK/8TKGdjAgr1LNoT0LDdTN6e7Pv2K0BJD Absg== 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 r59-v6si1826277plb.39.2018.09.25.02.32.02; Tue, 25 Sep 2018 02:32:18 -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 S1728977AbeIYPhZ (ORCPT + 99 others); Tue, 25 Sep 2018 11:37:25 -0400 Received: from terminus.zytor.com ([198.137.202.136]:53401 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726201AbeIYPhZ (ORCPT ); Tue, 25 Sep 2018 11:37:25 -0400 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id w8P9U6T53386007 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 25 Sep 2018 02:30:06 -0700 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id w8P9U6ZU3386004; Tue, 25 Sep 2018 02:30:06 -0700 Date: Tue, 25 Sep 2018 02:30:06 -0700 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Ding Xiang Message-ID: Cc: alexander.shishkin@linux.intel.com, tglx@linutronix.de, dingxiang@cmss.chinamobile.com, hpa@zytor.com, namhyung@kernel.org, mingo@kernel.org, jolsa@redhat.com, linux-kernel@vger.kernel.org, peterz@infradead.org, acme@redhat.com Reply-To: hpa@zytor.com, namhyung@kernel.org, mingo@kernel.org, tglx@linutronix.de, alexander.shishkin@linux.intel.com, dingxiang@cmss.chinamobile.com, peterz@infradead.org, acme@redhat.com, jolsa@redhat.com, linux-kernel@vger.kernel.org In-Reply-To: <1536284082-23466-1-git-send-email-dingxiang@cmss.chinamobile.com> References: <1536284082-23466-1-git-send-email-dingxiang@cmss.chinamobile.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] tools include: Adopt PTR_ERR_OR_ZERO from the kernel err.h header Git-Commit-ID: 01ab2e91103b8c23dfedfeb799bc8b810d585bd0 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, DATE_IN_FUTURE_96_Q autolearn=ham autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 01ab2e91103b8c23dfedfeb799bc8b810d585bd0 Gitweb: https://git.kernel.org/tip/01ab2e91103b8c23dfedfeb799bc8b810d585bd0 Author: Ding Xiang AuthorDate: Fri, 7 Sep 2018 09:34:41 +0800 Committer: Arnaldo Carvalho de Melo CommitDate: Wed, 19 Sep 2018 10:25:08 -0300 tools include: Adopt PTR_ERR_OR_ZERO from the kernel err.h header Add PTR_ERR_OR_ZERO, so that tools can use it, just like the kernel. Signed-off-by: Ding Xiang Cc: Alexander Shishkin Cc: Jiri Olsa Cc: Namhyung Kim Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/1536284082-23466-1-git-send-email-dingxiang@cmss.chinamobile.com Signed-off-by: Arnaldo Carvalho de Melo --- tools/include/linux/err.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tools/include/linux/err.h b/tools/include/linux/err.h index 7a8b61ad44cb..094649667bae 100644 --- a/tools/include/linux/err.h +++ b/tools/include/linux/err.h @@ -52,4 +52,11 @@ static inline bool __must_check IS_ERR_OR_NULL(__force const void *ptr) return unlikely(!ptr) || IS_ERR_VALUE((unsigned long)ptr); } +static inline int __must_check PTR_ERR_OR_ZERO(__force const void *ptr) +{ + if (IS_ERR(ptr)) + return PTR_ERR(ptr); + else + return 0; +} #endif /* _LINUX_ERR_H */