From patchwork Wed Mar 20 06:36:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yue Haibing X-Patchwork-Id: 10860927 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 B252F17E9 for ; Wed, 20 Mar 2019 06:37:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 89F49299FF for ; Wed, 20 Mar 2019 06:37:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7DDB529A1A; Wed, 20 Mar 2019 06:37:34 +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 25D9B29A1D for ; Wed, 20 Mar 2019 06:37:34 +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=Pl5x+oPfRWjwyxeFt/C1W+Bp2piOYUxMYCxqOjvTgkU=; b=NgZwMPp2A78tO+ 1mAmrfhuc2suvf8p5HSmVcgrTMQg14c0jyUuRUaki21vD7e06jMCMYIs61+vj1LL1Y159Q4TcJDLF UJAvZg6mLwo95jmbkGuLSzPhYqSNu9VkQ5hFoBLZ1iu1DgC26le6m1jJf3xq03vykz0a6TuXReSVt ldZgYy+VBTSqWaBnDk8hhvh7aemjx8N7kQe3llmfPKY39Ek5KYoqHrmWSZAv+BHIA9uce1f5iC9g7 M8geJ+XfE0UipBsqtxSF7pja9cO0Uy3zxdjJYbapNI/vI+fVHca7oocykG1UCzHQzGF14Fv8mcY3w fK1v1PNlwMFutt7Kc2ng==; 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 1h6Uqy-0000uT-36; Wed, 20 Mar 2019 06:37:32 +0000 Received: from szxga06-in.huawei.com ([45.249.212.32] helo=huawei.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h6Uqo-0000dw-Ib for linux-arm-kernel@lists.infradead.org; Wed, 20 Mar 2019 06:37:28 +0000 Received: from DGGEMS409-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id C823C4430826E86D45DF; Wed, 20 Mar 2019 14:37:16 +0800 (CST) Received: from localhost (10.177.31.96) by DGGEMS409-HUB.china.huawei.com (10.3.19.209) with Microsoft SMTP Server id 14.3.408.0; Wed, 20 Mar 2019 14:37:07 +0800 From: Yue Haibing To: , , , , , , , , Subject: [PATCH 2/2] perf cs-etm: return errcode in cs_etm__process_auxtrace_info() Date: Wed, 20 Mar 2019 14:36:26 +0800 Message-ID: <20190320063626.14792-3-yuehaibing@huawei.com> X-Mailer: git-send-email 2.10.2.windows.1 In-Reply-To: <20190320063626.14792-1-yuehaibing@huawei.com> References: <20190320063626.14792-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-20190319_233723_251227_9AEA127B X-CRM114-Status: UNSURE ( 9.79 ) X-CRM114-Notice: Please train this message. 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 Make sure 'err' is set in every err path, and returned it to callers intead of -EINVAL. Fixes: cd8bfd8c973e ("perf tools: Add processing of coresight metadata") Signed-off-by: YueHaibing --- 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; }