From patchwork Thu Mar 21 02:31:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yue Haibing X-Patchwork-Id: 10862833 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EA58E15AC for ; Thu, 21 Mar 2019 02:32:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C6F6C29E30 for ; Thu, 21 Mar 2019 02:32:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B99B129E76; Thu, 21 Mar 2019 02:32:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 260B229E30 for ; Thu, 21 Mar 2019 02:32:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=/Upw3Rb2xYC9QEuVWjqqBDoHQ3YmY+FnAl56WCtP4NY=; b=p2vN77uPemF6oD bQWe+vjVZU9YGY7nI6XiuZqMzR1AnhkHIMpfHO8SEIlPqaTAPktNeIA7tMCjS3n456bEFc798SWO7 XEmiW2CfrDzX5hmNraJNwbmPrzJRobdJN+dbtoon+MQeu22necl/ohZibkp3AA8Cr+itKFZGm8trI CH0nXUZjg9s21MaQgsPW4/5att5LaqrwJXJhj+bRziFc1WL7SgPIUpy7XC7VD+KPwSNM8DfGohUmi FNwyhDcJ2PIKvVkzYE7suITskbdsgs954r/cFryheED9ZIKhPoysxmIeoiFN9PD5TeN77JEjneOgS EgsH9nu0K92Tac3e3mWA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h6nV6-00027t-0L; Thu, 21 Mar 2019 02:32:12 +0000 Received: from szxga04-in.huawei.com ([45.249.212.190] helo=huawei.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h6nUr-0001rR-Qr for linux-arm-kernel@lists.infradead.org; Thu, 21 Mar 2019 02:32:04 +0000 Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 9AE67D7616668189EA82; Thu, 21 Mar 2019 10:31:55 +0800 (CST) Received: from localhost (10.177.31.96) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.408.0; Thu, 21 Mar 2019 10:31:47 +0800 From: Yue Haibing To: , , , , , , , , Subject: [PATCH v2 1/2] perf cs-etm: Remove errnoeous ERR_PTR() usage in cs_etm__process_auxtrace_info Date: Thu, 21 Mar 2019 10:31:21 +0800 Message-ID: <20190321023122.21332-2-yuehaibing@huawei.com> X-Mailer: git-send-email 2.10.2.windows.1 In-Reply-To: <20190321023122.21332-1-yuehaibing@huawei.com> References: <20190321023122.21332-1-yuehaibing@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.177.31.96] X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190320_193158_686044_6C668AFD X-CRM114-Status: GOOD ( 11.18 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: YueHaibing , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: YueHaibing intlist__findnew() doesn't uses ERR_PTR() as a return mechanism so its callers shouldn't try to extract the error using PTR_ERR( ret) from intlist__findnew(), make cs_etm__process_auxtrace_info return -ENOMEM instead. Fixes: cd8bfd8c973e ("perf tools: Add processing of coresight metadata") Signed-off-by: YueHaibing Reviewed-by: Mathieu Poirier --- tools/perf/util/cs-etm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c index 1108049..fd7f1da 100644 --- a/tools/perf/util/cs-etm.c +++ b/tools/perf/util/cs-etm.c @@ -1908,7 +1908,7 @@ int cs_etm__process_auxtrace_info(union perf_event *event, /* Something went wrong, no need to continue */ if (!inode) { - err = PTR_ERR(inode); + err = -ENOMEM; goto err_free_metadata; } From patchwork Thu Mar 21 02:31:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yue Haibing X-Patchwork-Id: 10862835 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4E7C513B5 for ; Thu, 21 Mar 2019 02:32:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 294B229E31 for ; Thu, 21 Mar 2019 02:32:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1D13829E76; Thu, 21 Mar 2019 02:32:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BF5D229E31 for ; Thu, 21 Mar 2019 02:32:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=W4jWe76wxxJES/qb9eX9nu7CyZ73IsSDBqX6+dWVaKU=; b=UTO3Not5pVPCsA /ZKGwclTCHe7LpDlEix13KA+k2gchjS55JTbzZ8qwt5qx803PwoZO+zTl1kzqax4mzdiiUGaIkExb eVENYTMEZMvkEyXsJQMPHX9qYKaj2jbXQWlriZglJ7XWo7OpZ3QrQVTVyAoFMJefMvrA6yEBxb+LO pc0HTDO5HTXS1Uw3veFw0aynykiW0Wqo2B7B+tFMqyTHWeGYyJ5WnwqNLCKLdCyuXtk3tjHNi5hsW aXikJN3ppTQs28fEg/4OvpJubHfOV+tjOW+8V0pIcjKgNkBFn/FFuk1m3Uptv3zwwZ7npvIET/q2y 5PxMz8qjPJhRspIBCpEg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h6nVJ-0002MS-5S; Thu, 21 Mar 2019 02:32:25 +0000 Received: from szxga04-in.huawei.com ([45.249.212.190] helo=huawei.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h6nUx-0001zp-KK for linux-arm-kernel@lists.infradead.org; Thu, 21 Mar 2019 02:32:11 +0000 Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id AA81C19B84CBE202FE6A; Thu, 21 Mar 2019 10:32:00 +0800 (CST) Received: from localhost (10.177.31.96) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.408.0; Thu, 21 Mar 2019 10:31:50 +0800 From: Yue Haibing To: , , , , , , , , Subject: [PATCH v2 2/2] perf cs-etm: return errcode in cs_etm__process_auxtrace_info() Date: Thu, 21 Mar 2019 10:31:22 +0800 Message-ID: <20190321023122.21332-3-yuehaibing@huawei.com> X-Mailer: git-send-email 2.10.2.windows.1 In-Reply-To: <20190321023122.21332-1-yuehaibing@huawei.com> References: <20190321023122.21332-1-yuehaibing@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.177.31.96] X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190320_193204_164244_8E14BF4B X-CRM114-Status: GOOD ( 10.53 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: YueHaibing , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: YueHaibing 'err' is set in err path, but it's not returned to callers. Don't always return -EINVAL, return err. Fixes: cd8bfd8c973e ("perf tools: Add processing of coresight metadata") Signed-off-by: YueHaibing Reviewed-by: Mathieu Poirier --- tools/perf/util/cs-etm.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c index fd7f1da..2cc773a 100644 --- a/tools/perf/util/cs-etm.c +++ b/tools/perf/util/cs-etm.c @@ -1965,8 +1965,10 @@ int cs_etm__process_auxtrace_info(union perf_event *event, session->auxtrace = &etm->auxtrace; etm->unknown_thread = thread__new(999999999, 999999999); - if (!etm->unknown_thread) + if (!etm->unknown_thread) { + err = -ENOMEM; goto err_free_queues; + } /* * Initialize list node so that at thread__zput() we can avoid @@ -1978,8 +1980,10 @@ int cs_etm__process_auxtrace_info(union perf_event *event, if (err) goto err_delete_thread; - if (thread__init_map_groups(etm->unknown_thread, etm->machine)) + if (thread__init_map_groups(etm->unknown_thread, etm->machine)) { + err = -ENOMEM; goto err_delete_thread; + } if (dump_trace) { cs_etm__print_auxtrace_info(auxtrace_info->priv, num_cpu); @@ -2023,5 +2027,5 @@ int cs_etm__process_auxtrace_info(union perf_event *event, err_free_hdr: zfree(&hdr); - return -EINVAL; + return err; }