Skip to content

Commit cab280b

Browse files
mikel-armbbgregkh
authored andcommitted
coresight: cti: Fix bug clearing sysfs links on callback
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: 177af82 ("coresight: cti: Enable CTI associated with devices") Reported-by: Tingwei Zhang <tingwei@codeaurora.org> Acked-by: Suzuki K Poulose <suzuki.poulose@arm.com> Signed-off-by: Mike Leach <mike.leach@linaro.org> Signed-off-by: Tingwei Zhang <tingwei@codeaurora.org> Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org> Link: https://lore.kernel.org/r/20200928163513.70169-19-mathieu.poirier@linaro.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 1cce921 commit cab280b

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

‎drivers/hwtracing/coresight/coresight-cti.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ static void cti_remove_assoc_from_csdev(struct coresight_device *csdev)
591591
ctidrv = csdev_to_cti_drvdata(csdev->ect_dev);
592592
ctidev = &ctidrv->ctidev;
593593
list_for_each_entry(tc, &ctidev->trig_cons, node) {
594-
if (tc->con_dev == csdev->ect_dev) {
594+
if (tc->con_dev == csdev) {
595595
cti_remove_sysfs_link(ctidrv, tc);
596596
tc->con_dev = NULL;
597597
break;

‎drivers/hwtracing/coresight/coresight.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1246,8 +1246,6 @@ static void coresight_device_release(struct device *dev)
12461246
{
12471247
struct coresight_device *csdev = to_coresight_device(dev);
12481248

1249-
if (cti_assoc_ops && cti_assoc_ops->remove)
1250-
cti_assoc_ops->remove(csdev);
12511249
fwnode_handle_put(csdev->dev.fwnode);
12521250
kfree(csdev->refcnt);
12531251
kfree(csdev);
@@ -1582,6 +1580,8 @@ void coresight_unregister(struct coresight_device *csdev)
15821580
{
15831581
etm_perf_del_symlink_sink(csdev);
15841582
/* Remove references of that device in the topology */
1583+
if (cti_assoc_ops && cti_assoc_ops->remove)
1584+
cti_assoc_ops->remove(csdev);
15851585
coresight_remove_conns(csdev);
15861586
coresight_clear_default_sink(csdev);
15871587
coresight_release_platform_data(csdev, csdev->pdata);

0 commit comments

Comments
 (0)