Skip to content

Commit f6028ee

Browse files
yabincSuzuki K Poulose
authored andcommitted
coresight: core: Disable helpers for devices that fail to enable
When enabling a SINK or LINK type coresight device fails, the associated helpers should be disabled. Fixes: 6148652 ("coresight: Enable and disable helper devices adjacent to the path") Signed-off-by: Yabin Cui <[email protected]> Suggested-by: Suzuki K Poulose <[email protected]> Reviewed-by: James Clark <[email protected]> Reviewed-by: Mike Leach <[email protected]> Reviewed-by: Leo Yan <[email protected]> Signed-off-by: Suzuki K Poulose <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent a03a0a0 commit f6028ee

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

drivers/hwtracing/coresight/coresight-core.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ int coresight_enable_path(struct coresight_path *path, enum cs_mode mode,
465465
/* Enable all helpers adjacent to the path first */
466466
ret = coresight_enable_helpers(csdev, mode, path);
467467
if (ret)
468-
goto err;
468+
goto err_disable_path;
469469
/*
470470
* ETF devices are tricky... They can be a link or a sink,
471471
* depending on how they are configured. If an ETF has been
@@ -486,8 +486,10 @@ int coresight_enable_path(struct coresight_path *path, enum cs_mode mode,
486486
* that need disabling. Disabling the path here
487487
* would mean we could disrupt an existing session.
488488
*/
489-
if (ret)
489+
if (ret) {
490+
coresight_disable_helpers(csdev, path);
490491
goto out;
492+
}
491493
break;
492494
case CORESIGHT_DEV_TYPE_SOURCE:
493495
/* sources are enabled from either sysFS or Perf */
@@ -497,16 +499,19 @@ int coresight_enable_path(struct coresight_path *path, enum cs_mode mode,
497499
child = list_next_entry(nd, link)->csdev;
498500
ret = coresight_enable_link(csdev, parent, child, source);
499501
if (ret)
500-
goto err;
502+
goto err_disable_helpers;
501503
break;
502504
default:
503-
goto err;
505+
ret = -EINVAL;
506+
goto err_disable_helpers;
504507
}
505508
}
506509

507510
out:
508511
return ret;
509-
err:
512+
err_disable_helpers:
513+
coresight_disable_helpers(csdev, path);
514+
err_disable_path:
510515
coresight_disable_path_from(path, nd);
511516
goto out;
512517
}

0 commit comments

Comments
 (0)