From patchwork Tue Oct 27 13:51:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 290001 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 179FBC388F9 for ; Tue, 27 Oct 2020 14:36:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B9EB82225E for ; Tue, 27 Oct 2020 14:36:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603809375; bh=kDkWw07+ycoeL9g5Rbqp86xLJvlkFUxmFz1Zdoqi1e8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Ege9bRNQs3DuDv1sv2mwFzdiuNg9Wm1q+nh+Y7zqimBtsUTp44IHXJ6/YO+W8YQpq CncdgWJWEkeQvbNhHoaux41dSIrytRQ0dheE3PGt4BEunaR0km8eIz0DZnBJMtBtdW QM4qu/ekbF5lf9RfAQ1ZdX1VKol569Ii+ZcYLL8U= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760746AbgJ0OgO (ORCPT ); Tue, 27 Oct 2020 10:36:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:35044 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760741AbgJ0OgN (ORCPT ); Tue, 27 Oct 2020 10:36:13 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 109AB207BB; Tue, 27 Oct 2020 14:36:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603809372; bh=kDkWw07+ycoeL9g5Rbqp86xLJvlkFUxmFz1Zdoqi1e8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JJ5FtbSalGATYM6Kb3GkaY9ffVxGMh+ILvdZ69ULBC8I1+l7lhlLFrmaHhuUmWHFS uD4G39m2pq6CU7fdD2rS7sDNAXk/HCd2pAISd7z/jqGcmnA5jc0oEgizicDMvwUzZY fD3bvrdzHVeV+pHNz6OZqUUy8Lf/mjQz/EZnQYMY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mike Leach , Suzuki K Poulose , Tingwei Zhang , Mathieu Poirier , Sasha Levin Subject: [PATCH 5.4 172/408] coresight: etm: perf: Fix warning caused by etm_setup_aux failure Date: Tue, 27 Oct 2020 14:51:50 +0100 Message-Id: <20201027135503.074846948@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135455.027547757@linuxfoundation.org> References: <20201027135455.027547757@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Tingwei Zhang [ Upstream commit 716f5652a13122364a65e694386b9b26f5e98c51 ] When coresight_build_path() fails on all the cpus, etm_setup_aux calls etm_free_aux() to free allocated event_data. WARN_ON(cpumask_empty(mask) will be triggered since cpu mask is empty. Check event_data->snk_config is not NULL first to avoid this warning. Fixes: f5200aa9831f38 ("coresight: perf: Refactor function free_event_data()") Reviewed-by: Mike Leach Reviewed-by: Suzuki K Poulose Signed-off-by: Tingwei Zhang Signed-off-by: Mathieu Poirier Link: https://lore.kernel.org/r/20200928163513.70169-9-mathieu.poirier@linaro.org Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/hwtracing/coresight/coresight-etm-perf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.c b/drivers/hwtracing/coresight/coresight-etm-perf.c index c4b9898e28418..9b0c5d719232f 100644 --- a/drivers/hwtracing/coresight/coresight-etm-perf.c +++ b/drivers/hwtracing/coresight/coresight-etm-perf.c @@ -126,10 +126,10 @@ static void free_sink_buffer(struct etm_event_data *event_data) cpumask_t *mask = &event_data->mask; struct coresight_device *sink; - if (WARN_ON(cpumask_empty(mask))) + if (!event_data->snk_config) return; - if (!event_data->snk_config) + if (WARN_ON(cpumask_empty(mask))) return; cpu = cpumask_first(mask);