@@ -465,7 +465,7 @@ int coresight_enable_path(struct coresight_path *path, enum cs_mode mode,
465
465
/* Enable all helpers adjacent to the path first */
466
466
ret = coresight_enable_helpers (csdev , mode , path );
467
467
if (ret )
468
- goto err ;
468
+ goto err_disable_path ;
469
469
/*
470
470
* ETF devices are tricky... They can be a link or a sink,
471
471
* 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,
486
486
* that need disabling. Disabling the path here
487
487
* would mean we could disrupt an existing session.
488
488
*/
489
- if (ret )
489
+ if (ret ) {
490
+ coresight_disable_helpers (csdev , path );
490
491
goto out ;
492
+ }
491
493
break ;
492
494
case CORESIGHT_DEV_TYPE_SOURCE :
493
495
/* sources are enabled from either sysFS or Perf */
@@ -497,16 +499,19 @@ int coresight_enable_path(struct coresight_path *path, enum cs_mode mode,
497
499
child = list_next_entry (nd , link )-> csdev ;
498
500
ret = coresight_enable_link (csdev , parent , child , source );
499
501
if (ret )
500
- goto err ;
502
+ goto err_disable_helpers ;
501
503
break ;
502
504
default :
503
- goto err ;
505
+ ret = - EINVAL ;
506
+ goto err_disable_helpers ;
504
507
}
505
508
}
506
509
507
510
out :
508
511
return ret ;
509
- err :
512
+ err_disable_helpers :
513
+ coresight_disable_helpers (csdev , path );
514
+ err_disable_path :
510
515
coresight_disable_path_from (path , nd );
511
516
goto out ;
512
517
}
0 commit comments