* [PATCH] coresight: Handle build path error
@ 2016-05-04 10:41 Suzuki K Poulose
2016-05-06 14:26 ` Mathieu Poirier
0 siblings, 1 reply; 7+ messages in thread
From: Suzuki K Poulose @ 2016-05-04 10:41 UTC (permalink / raw)
To: linux-arm-kernel; +Cc: linux-kernel, Suzuki K Poulose, Mathie Porier
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
Cc: Mathie Porier <mathieu.poirier@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
---
drivers/hwtracing/coresight/coresight.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c
index 2ea5961..e0c5166 100644
--- a/drivers/hwtracing/coresight/coresight.c
+++ b/drivers/hwtracing/coresight/coresight.c
@@ -393,6 +393,7 @@ out:
struct list_head *coresight_build_path(struct coresight_device *csdev)
{
struct list_head *path;
+ int rc;
path = kzalloc(sizeof(struct list_head), GFP_KERNEL);
if (!path)
@@ -400,9 +401,10 @@ struct list_head *coresight_build_path(struct coresight_device *csdev)
INIT_LIST_HEAD(path);
- if (_coresight_build_path(csdev, path)) {
+ rc = _coresight_build_path(csdev, path);
+ if (rc) {
kfree(path);
- path = NULL;
+ return ERR_PTR(rc);
}
return path;
@@ -448,8 +450,9 @@ int coresight_enable(struct coresight_device *csdev)
goto out;
path = coresight_build_path(csdev);
- if (!path) {
+ if (IS_ERR(path)) {
pr_err("building path(s) failed\n");
+ ret = PTR_ERR(path);
goto out;
}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] coresight: Handle build path error
2016-05-04 10:41 [PATCH] coresight: Handle build path error Suzuki K Poulose
@ 2016-05-06 14:26 ` Mathieu Poirier
2016-05-06 14:32 ` Suzuki K Poulose
2016-05-06 14:35 ` Suzuki K Poulose
0 siblings, 2 replies; 7+ messages in thread
From: Mathieu Poirier @ 2016-05-06 14:26 UTC (permalink / raw)
To: Suzuki K Poulose; +Cc: linux-arm-kernel, linux-kernel
On 4 May 2016 at 04:41, Suzuki K Poulose <suzuki.poulose@arm.com> wrote:
> 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
>
> Cc: Mathie Porier <mathieu.poirier@linaro.org>
> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
This patch looks good - thanks for the fix. Due to how late we are in
the cycle I'd ask Greg to pick it up right away but there is a
(couple) of typos in my name on the CC line. Either resend another
patch with the correct spelling or remove the CC line altogether.
Thanks,
Mathieu
> ---
> drivers/hwtracing/coresight/coresight.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c
> index 2ea5961..e0c5166 100644
> --- a/drivers/hwtracing/coresight/coresight.c
> +++ b/drivers/hwtracing/coresight/coresight.c
> @@ -393,6 +393,7 @@ out:
> struct list_head *coresight_build_path(struct coresight_device *csdev)
> {
> struct list_head *path;
> + int rc;
>
> path = kzalloc(sizeof(struct list_head), GFP_KERNEL);
> if (!path)
> @@ -400,9 +401,10 @@ struct list_head *coresight_build_path(struct coresight_device *csdev)
>
> INIT_LIST_HEAD(path);
>
> - if (_coresight_build_path(csdev, path)) {
> + rc = _coresight_build_path(csdev, path);
> + if (rc) {
> kfree(path);
> - path = NULL;
> + return ERR_PTR(rc);
> }
>
> return path;
> @@ -448,8 +450,9 @@ int coresight_enable(struct coresight_device *csdev)
> goto out;
>
> path = coresight_build_path(csdev);
> - if (!path) {
> + if (IS_ERR(path)) {
> pr_err("building path(s) failed\n");
> + ret = PTR_ERR(path);
> goto out;
> }
>
> --
> 1.7.9.5
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] coresight: Handle build path error
2016-05-06 14:26 ` Mathieu Poirier
@ 2016-05-06 14:32 ` Suzuki K Poulose
2016-05-06 14:35 ` Suzuki K Poulose
1 sibling, 0 replies; 7+ messages in thread
From: Suzuki K Poulose @ 2016-05-06 14:32 UTC (permalink / raw)
To: Mathieu Poirier; +Cc: linux-arm-kernel, linux-kernel
On 06/05/16 15:26, Mathieu Poirier wrote:
> On 4 May 2016 at 04:41, Suzuki K Poulose <suzuki.poulose@arm.com> wrote:
>> 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
>>
>> Cc: Mathie Porier <mathieu.poirier@linaro.org>
>> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
>
> This patch looks good - thanks for the fix. Due to how late we are in
> the cycle I'd ask Greg to pick it up right away but there is a
> (couple) of typos in my name on the CC line. Either resend another
> patch with the correct spelling or remove the CC line altogether.
Sorry about that. will resend it fixed.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] coresight: Handle build path error
2016-05-06 14:26 ` Mathieu Poirier
2016-05-06 14:32 ` Suzuki K Poulose
@ 2016-05-06 14:35 ` Suzuki K Poulose
2016-05-06 14:43 ` Mathieu Poirier
1 sibling, 1 reply; 7+ messages in thread
From: Suzuki K Poulose @ 2016-05-06 14:35 UTC (permalink / raw)
To: linux-arm-kernel; +Cc: linux-kernel, gregkh, Suzuki K Poulose, Mathieu Poirier
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
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
---
drivers/hwtracing/coresight/coresight.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c
index 2ea5961..e0c5166 100644
--- a/drivers/hwtracing/coresight/coresight.c
+++ b/drivers/hwtracing/coresight/coresight.c
@@ -393,6 +393,7 @@ out:
struct list_head *coresight_build_path(struct coresight_device *csdev)
{
struct list_head *path;
+ int rc;
path = kzalloc(sizeof(struct list_head), GFP_KERNEL);
if (!path)
@@ -400,9 +401,10 @@ struct list_head *coresight_build_path(struct coresight_device *csdev)
INIT_LIST_HEAD(path);
- if (_coresight_build_path(csdev, path)) {
+ rc = _coresight_build_path(csdev, path);
+ if (rc) {
kfree(path);
- path = NULL;
+ return ERR_PTR(rc);
}
return path;
@@ -448,8 +450,9 @@ int coresight_enable(struct coresight_device *csdev)
goto out;
path = coresight_build_path(csdev);
- if (!path) {
+ if (IS_ERR(path)) {
pr_err("building path(s) failed\n");
+ ret = PTR_ERR(path);
goto out;
}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] coresight: Handle build path error
2016-05-06 14:35 ` Suzuki K Poulose
@ 2016-05-06 14:43 ` Mathieu Poirier
2016-06-01 18:04 ` Suzuki K Poulose
0 siblings, 1 reply; 7+ messages in thread
From: Mathieu Poirier @ 2016-05-06 14:43 UTC (permalink / raw)
To: Suzuki K Poulose; +Cc: linux-arm-kernel, linux-kernel, Greg KH
On 6 May 2016 at 08:35, Suzuki K Poulose <suzuki.poulose@arm.com> wrote:
> 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
>
> Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
> ---
> drivers/hwtracing/coresight/coresight.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c
> index 2ea5961..e0c5166 100644
> --- a/drivers/hwtracing/coresight/coresight.c
> +++ b/drivers/hwtracing/coresight/coresight.c
> @@ -393,6 +393,7 @@ out:
> struct list_head *coresight_build_path(struct coresight_device *csdev)
> {
> struct list_head *path;
> + int rc;
>
> path = kzalloc(sizeof(struct list_head), GFP_KERNEL);
> if (!path)
> @@ -400,9 +401,10 @@ struct list_head *coresight_build_path(struct coresight_device *csdev)
>
> INIT_LIST_HEAD(path);
>
> - if (_coresight_build_path(csdev, path)) {
> + rc = _coresight_build_path(csdev, path);
> + if (rc) {
> kfree(path);
> - path = NULL;
> + return ERR_PTR(rc);
> }
>
> return path;
> @@ -448,8 +450,9 @@ int coresight_enable(struct coresight_device *csdev)
> goto out;
>
> path = coresight_build_path(csdev);
> - if (!path) {
> + if (IS_ERR(path)) {
> pr_err("building path(s) failed\n");
> + ret = PTR_ERR(path);
> goto out;
> }
>
> --
> 1.7.9.5
>
Thanks for the correction:
Acked-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Greg, given how small the changes are can you pick this up? Otherwise
I'll simply keep it in my tree.
Thanks,
Mathieu
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] coresight: Handle build path error
2016-05-06 14:43 ` Mathieu Poirier
@ 2016-06-01 18:04 ` Suzuki K Poulose
2016-06-02 14:19 ` Mathieu Poirier
0 siblings, 1 reply; 7+ messages in thread
From: Suzuki K Poulose @ 2016-06-01 18:04 UTC (permalink / raw)
To: Mathieu Poirier; +Cc: linux-arm-kernel, linux-kernel, Greg KH
On 06/05/16 15:43, Mathieu Poirier wrote:
> On 6 May 2016 at 08:35, Suzuki K Poulose <suzuki.poulose@arm.com> wrote:
>> 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.
>>
>>
>
> Thanks for the correction:
>
> Acked-by: Mathieu Poirier <mathieu.poirier@linaro.org>
>
> Greg, given how small the changes are can you pick this up? Otherwise
> I'll simply keep it in my tree.
Should this go in for rc2 as a fix ?
Cheers
Suzuki
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] coresight: Handle build path error
2016-06-01 18:04 ` Suzuki K Poulose
@ 2016-06-02 14:19 ` Mathieu Poirier
0 siblings, 0 replies; 7+ messages in thread
From: Mathieu Poirier @ 2016-06-02 14:19 UTC (permalink / raw)
To: Suzuki K Poulose; +Cc: linux-arm-kernel, linux-kernel, Greg KH
On 1 June 2016 at 12:04, Suzuki K Poulose <Suzuki.Poulose@arm.com> wrote:
> On 06/05/16 15:43, Mathieu Poirier wrote:
>>
>> On 6 May 2016 at 08:35, Suzuki K Poulose <suzuki.poulose@arm.com> wrote:
>>>
>>> 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.
>>>
>
>>>
>>
>> Thanks for the correction:
>>
>> Acked-by: Mathieu Poirier <mathieu.poirier@linaro.org>
>>
>> Greg, given how small the changes are can you pick this up? Otherwise
>> I'll simply keep it in my tree.
>
>
> Should this go in for rc2 as a fix ?
It did not make it in time for the 4.7 merge window - it will be part
of the 4.8 cycle.
Thanks,
Mathieu
>
> Cheers
> Suzuki
>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2016-06-02 14:19 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-04 10:41 [PATCH] coresight: Handle build path error Suzuki K Poulose
2016-05-06 14:26 ` Mathieu Poirier
2016-05-06 14:32 ` Suzuki K Poulose
2016-05-06 14:35 ` Suzuki K Poulose
2016-05-06 14:43 ` Mathieu Poirier
2016-06-01 18:04 ` Suzuki K Poulose
2016-06-02 14:19 ` Mathieu Poirier
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).