Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp264920pxx; Wed, 28 Oct 2020 04:29:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzBc+YkZmppjxU8ezyvSH1FLdD9g3W0P5yWnG0S0AUU8cKCkhn/XZt1IrUezXaafBudhPr5 X-Received: by 2002:a50:c38e:: with SMTP id h14mr7478666edf.174.1603884571656; Wed, 28 Oct 2020 04:29:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603884571; cv=none; d=google.com; s=arc-20160816; b=JllaDZ/Ttd8uBLhqGFAuTLFiz6siAfdZw/iHau08S6KdXEl9n3mLmI5k2zKU7Ekvr3 SqX3p3mvjCJViGbFcYIue5uL++Zfy23vYz6puYRf7wP4quE4yZecweEZgSClPjTh0lWT Rez3rtcSmkZbVkEWBHZ0mhAfjIRwDURSlQK0WmhcTlY5G+5bzLZ8+pIR+Berrdbti4m9 Cm+SzJXg7xtHsb/mNwXvJ6Yp22/bxgf91V0pJxEIdxQszygpk9LZhQMITeiEao/T0U+H cg4/nrVTfz0AW7C5mS00n452EnfHMy+ojxaqAT0pQWbFQyQDQi82jOIrL6fwkRlr2WNj k2cw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=LvN1Ks/OvI/lSoux0Q+h234P3LFczK1+G6D39gqJIHQ=; b=YnIyuOUMcP1rWU4q6fXVR8mIfAo7wDneJ62up9F90WAuPGvXTvrBPS8+uWd8WZ2j2s 64WLdoizygQ+VMbZzhOsINI3JukAcgSylkHybkwrCF4JCqAgalzG4W1ZHCEtoH2zKM6Q DmVI1EKUHgfrfpA3KfOHfqGt7e0oq+BeC7YKFDtSeWoZ7NWR4fy9AgMO6p40MoO3PM4Q R2L85UJcrQz9OR0GE3nj+en84EhEFOiGv1a/uevnPU1I36xGtfHcEleWxDI1mC95+PSW Kaek5d6uBJfUOzJf90bKH7VfrsCwtqdpYGLk/8SxHXtbC1mnJpdliaxsDwAW+H9UqNBx SqTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=OagETKNS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t1si2868715ejb.712.2020.10.28.04.29.09; Wed, 28 Oct 2020 04:29:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=OagETKNS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1793574AbgJ0PHO (ORCPT + 99 others); Tue, 27 Oct 2020 11:07:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:36264 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1789410AbgJ0PCJ (ORCPT ); Tue, 27 Oct 2020 11:02:09 -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 D072922283; Tue, 27 Oct 2020 15:02:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603810928; bh=ZEAxDEAwnclqN4HOqQt+dV8f3ipy5wn8ge1j/LOeM24=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OagETKNSeqQsp9njP77HJV67+ZN4mpQaKE5ORgeCVZwBXzN493azBcQdcQPDGYgmL HepHjGkjC6HjLTsn6liDBhvlHdEgfB15NDbp1A0z68Y6yir45+9wmX/pyLhO1SYQEf x0iswjnOXWz8mLCvP1PsQcbqZYK19/IIBAqOE7mU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tingwei Zhang , Suzuki K Poulose , Mike Leach , Mathieu Poirier , Sasha Levin Subject: [PATCH 5.8 282/633] coresight: cti: Fix bug clearing sysfs links on callback Date: Tue, 27 Oct 2020 14:50:25 +0100 Message-Id: <20201027135535.906027700@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135522.655719020@linuxfoundation.org> References: <20201027135522.655719020@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mike Leach [ Upstream commit cab280bf3533c72f95ebdb65ce534b5cdc4729dc ] During module unload, a coresight driver module will call back into the CTI driver to remove any links between the two devices. The current code has 2 issues:- 1) in the CTI driver the matching code is matching to the wrong device so misses all the links. 2) The callback is called too late in the unload process resulting in a crash. This fixes both the issues. Fixes: 177af8285b59 ("coresight: cti: Enable CTI associated with devices") Reported-by: Tingwei Zhang Acked-by: Suzuki K Poulose Signed-off-by: Mike Leach Signed-off-by: Tingwei Zhang Signed-off-by: Mathieu Poirier Link: https://lore.kernel.org/r/20200928163513.70169-19-mathieu.poirier@linaro.org Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/hwtracing/coresight/coresight-cti.c | 2 +- drivers/hwtracing/coresight/coresight.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-cti.c b/drivers/hwtracing/coresight/coresight-cti.c index 92aa535f9e134..167fbc2e7033f 100644 --- a/drivers/hwtracing/coresight/coresight-cti.c +++ b/drivers/hwtracing/coresight/coresight-cti.c @@ -592,7 +592,7 @@ void cti_remove_assoc_from_csdev(struct coresight_device *csdev) ctidrv = csdev_to_cti_drvdata(csdev->ect_dev); ctidev = &ctidrv->ctidev; list_for_each_entry(tc, &ctidev->trig_cons, node) { - if (tc->con_dev == csdev->ect_dev) { + if (tc->con_dev == csdev) { cti_remove_sysfs_link(ctidrv, tc); tc->con_dev = NULL; break; diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c index f3efbb3b2b4d1..cf03af09c6ced 100644 --- a/drivers/hwtracing/coresight/coresight.c +++ b/drivers/hwtracing/coresight/coresight.c @@ -1023,7 +1023,6 @@ static void coresight_device_release(struct device *dev) { struct coresight_device *csdev = to_coresight_device(dev); - cti_remove_assoc_from_csdev(csdev); fwnode_handle_put(csdev->dev.fwnode); kfree(csdev->refcnt); kfree(csdev); @@ -1357,6 +1356,7 @@ void coresight_unregister(struct coresight_device *csdev) { etm_perf_del_symlink_sink(csdev); /* Remove references of that device in the topology */ + cti_remove_assoc_from_csdev(csdev); coresight_remove_conns(csdev); coresight_release_platform_data(csdev, csdev->pdata); device_unregister(&csdev->dev); -- 2.25.1