aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSuzuki K Poulose <suzuki.poulose@arm.com>2016-05-06 10:35:50 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-06-16 03:13:06 -0400
commit5014e904681ddbdf663bb20f134eb053ddccb181 (patch)
treeee0ae74d3ec6d2a003f101a1ea6df69b57f25ff1
parentf3b8172fe15fbed0d0d33d99780e122213e00684 (diff)
coresight: Handle build path error
Enabling a component via sysfs (echo 1 > enable_source), would trigger building a path from the enabled sources to the sink. If there is an error in the process (e.g, sink not enabled or the device (CPU corresponding to ETM) is not online), we never report failure, except for leaving a message in the dmesg. Do proper error checking for the build path and return the error. Before: $ echo 0 > /sys/devices/system/cpu/cpu2/online $ echo 1 > /sys/devices/cs_etm/cpu2/enable_source $ echo $? 0 After: $ echo 0 > /sys/devices/system/cpu/cpu2/online $ echo 1 > /sys/devices/cs_etm/cpu2/enable_source -bash: echo: write error: No such device or address Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com> Acked-by: Mathieu Poirier <mathieu.poirier@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/hwtracing/coresight/coresight.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c
index 0fdaaf4a8994..d08d1ab9bba5 100644
--- a/drivers/hwtracing/coresight/coresight.c
+++ b/drivers/hwtracing/coresight/coresight.c
@@ -425,6 +425,7 @@ out:
425struct list_head *coresight_build_path(struct coresight_device *csdev) 425struct list_head *coresight_build_path(struct coresight_device *csdev)
426{ 426{
427 struct list_head *path; 427 struct list_head *path;
428 int rc;
428 429
429 path = kzalloc(sizeof(struct list_head), GFP_KERNEL); 430 path = kzalloc(sizeof(struct list_head), GFP_KERNEL);
430 if (!path) 431 if (!path)
@@ -432,9 +433,10 @@ struct list_head *coresight_build_path(struct coresight_device *csdev)
432 433
433 INIT_LIST_HEAD(path); 434 INIT_LIST_HEAD(path);
434 435
435 if (_coresight_build_path(csdev, path)) { 436 rc = _coresight_build_path(csdev, path);
437 if (rc) {
436 kfree(path); 438 kfree(path);
437 path = NULL; 439 return ERR_PTR(rc);
438 } 440 }
439 441
440 return path; 442 return path;
@@ -507,8 +509,9 @@ int coresight_enable(struct coresight_device *csdev)
507 goto out; 509 goto out;
508 510
509 path = coresight_build_path(csdev); 511 path = coresight_build_path(csdev);
510 if (!path) { 512 if (IS_ERR(path)) {
511 pr_err("building path(s) failed\n"); 513 pr_err("building path(s) failed\n");
514 ret = PTR_ERR(path);
512 goto out; 515 goto out;
513 } 516 }
514 517