linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] minor fixes for perf cs-etm
@ 2019-03-20  6:36 Yue Haibing
  2019-03-20  6:36 ` [PATCH 1/2] perf cs-etm: Remove errnoeous ERR_PTR() usage in in cs_etm__process_auxtrace_info Yue Haibing
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Yue Haibing @ 2019-03-20  6:36 UTC (permalink / raw)
  To: mathieu.poirier, suzuki.poulose, peterz, mingo, acme,
	alexander.shishkin, jolsa, namhyung, arnaldo.melo
  Cc: linux-kernel, linux-arm-kernel, YueHaibing

From: YueHaibing <yuehaibing@huawei.com>

This patch series fixes two issue:
1. fix pass-zero-to-ERR_PTR warning
2. return correct errcode to upstream callers

YueHaibing (2):
  perf cs-etm: Remove errnoeous ERR_PTR() usage in in
    cs_etm__process_auxtrace_info
  perf cs-etm: return errcode in cs_etm__process_auxtrace_info()

 tools/perf/util/cs-etm.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

-- 
2.7.0



^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] perf cs-etm: Remove errnoeous ERR_PTR() usage in in cs_etm__process_auxtrace_info
  2019-03-20  6:36 [PATCH 0/2] minor fixes for perf cs-etm Yue Haibing
@ 2019-03-20  6:36 ` Yue Haibing
  2019-03-20  6:36 ` [PATCH 2/2] perf cs-etm: return errcode in cs_etm__process_auxtrace_info() Yue Haibing
  2019-03-20 16:16 ` [PATCH 0/2] minor fixes for perf cs-etm Mathieu Poirier
  2 siblings, 0 replies; 5+ messages in thread
From: Yue Haibing @ 2019-03-20  6:36 UTC (permalink / raw)
  To: mathieu.poirier, suzuki.poulose, peterz, mingo, acme,
	alexander.shishkin, jolsa, namhyung, arnaldo.melo
  Cc: linux-kernel, linux-arm-kernel, YueHaibing

From: YueHaibing <yuehaibing@huawei.com>

intlist__findnew() doesn't uses ERR_PTR() as a return mechanism so its callers
shouldn't try to extract the error using PTR_ERR(ret-from-intlist__findnew()),
make cs_etm__process_auxtrace_info9) return -ENOMEM instead.

Fixes: cd8bfd8c973e ("perf tools: Add processing of coresight metadata")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 tools/perf/util/cs-etm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c
index 1108049..fd7f1da 100644
--- a/tools/perf/util/cs-etm.c
+++ b/tools/perf/util/cs-etm.c
@@ -1908,7 +1908,7 @@ int cs_etm__process_auxtrace_info(union perf_event *event,
 
 		/* Something went wrong, no need to continue */
 		if (!inode) {
-			err = PTR_ERR(inode);
+			err = -ENOMEM;
 			goto err_free_metadata;
 		}
 
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] perf cs-etm: return errcode in cs_etm__process_auxtrace_info()
  2019-03-20  6:36 [PATCH 0/2] minor fixes for perf cs-etm Yue Haibing
  2019-03-20  6:36 ` [PATCH 1/2] perf cs-etm: Remove errnoeous ERR_PTR() usage in in cs_etm__process_auxtrace_info Yue Haibing
@ 2019-03-20  6:36 ` Yue Haibing
  2019-03-20 16:16 ` [PATCH 0/2] minor fixes for perf cs-etm Mathieu Poirier
  2 siblings, 0 replies; 5+ messages in thread
From: Yue Haibing @ 2019-03-20  6:36 UTC (permalink / raw)
  To: mathieu.poirier, suzuki.poulose, peterz, mingo, acme,
	alexander.shishkin, jolsa, namhyung, arnaldo.melo
  Cc: linux-kernel, linux-arm-kernel, YueHaibing

From: YueHaibing <yuehaibing@huawei.com>

Make sure 'err' is set in every err path, and returned it to
callers intead of -EINVAL.

Fixes: cd8bfd8c973e ("perf tools: Add processing of coresight metadata")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 tools/perf/util/cs-etm.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c
index fd7f1da..2cc773a 100644
--- a/tools/perf/util/cs-etm.c
+++ b/tools/perf/util/cs-etm.c
@@ -1965,8 +1965,10 @@ int cs_etm__process_auxtrace_info(union perf_event *event,
 	session->auxtrace = &etm->auxtrace;
 
 	etm->unknown_thread = thread__new(999999999, 999999999);
-	if (!etm->unknown_thread)
+	if (!etm->unknown_thread) {
+		err = -ENOMEM;
 		goto err_free_queues;
+	}
 
 	/*
 	 * Initialize list node so that at thread__zput() we can avoid
@@ -1978,8 +1980,10 @@ int cs_etm__process_auxtrace_info(union perf_event *event,
 	if (err)
 		goto err_delete_thread;
 
-	if (thread__init_map_groups(etm->unknown_thread, etm->machine))
+	if (thread__init_map_groups(etm->unknown_thread, etm->machine)) {
+		err = -ENOMEM;
 		goto err_delete_thread;
+	}
 
 	if (dump_trace) {
 		cs_etm__print_auxtrace_info(auxtrace_info->priv, num_cpu);
@@ -2023,5 +2027,5 @@ int cs_etm__process_auxtrace_info(union perf_event *event,
 err_free_hdr:
 	zfree(&hdr);
 
-	return -EINVAL;
+	return err;
 }
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/2] minor fixes for perf cs-etm
  2019-03-20  6:36 [PATCH 0/2] minor fixes for perf cs-etm Yue Haibing
  2019-03-20  6:36 ` [PATCH 1/2] perf cs-etm: Remove errnoeous ERR_PTR() usage in in cs_etm__process_auxtrace_info Yue Haibing
  2019-03-20  6:36 ` [PATCH 2/2] perf cs-etm: return errcode in cs_etm__process_auxtrace_info() Yue Haibing
@ 2019-03-20 16:16 ` Mathieu Poirier
  2019-03-21  2:09   ` YueHaibing
  2 siblings, 1 reply; 5+ messages in thread
From: Mathieu Poirier @ 2019-03-20 16:16 UTC (permalink / raw)
  To: Yue Haibing
  Cc: Suzuki K. Poulose, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, Alexander Shishkin, Jiri Olsa,
	Namhyung Kim, Arnaldo Carvalho de Melo,
	Linux Kernel Mailing List, linux-arm-kernel

On Wed, 20 Mar 2019 at 00:37, Yue Haibing <yuehaibing@huawei.com> wrote:
>
> From: YueHaibing <yuehaibing@huawei.com>
>
> This patch series fixes two issue:
> 1. fix pass-zero-to-ERR_PTR warning
> 2. return correct errcode to upstream callers
>
> YueHaibing (2):
>   perf cs-etm: Remove errnoeous ERR_PTR() usage in in
>     cs_etm__process_auxtrace_info
>   perf cs-etm: return errcode in cs_etm__process_auxtrace_info()
>
>  tools/perf/util/cs-etm.c | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)

Please run your work through checkpatch and resend.

Mathieu

>
> --
> 2.7.0
>
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/2] minor fixes for perf cs-etm
  2019-03-20 16:16 ` [PATCH 0/2] minor fixes for perf cs-etm Mathieu Poirier
@ 2019-03-21  2:09   ` YueHaibing
  0 siblings, 0 replies; 5+ messages in thread
From: YueHaibing @ 2019-03-21  2:09 UTC (permalink / raw)
  To: Mathieu Poirier
  Cc: Suzuki K. Poulose, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, Alexander Shishkin, Jiri Olsa,
	Namhyung Kim, Arnaldo Carvalho de Melo,
	Linux Kernel Mailing List, linux-arm-kernel

On 2019/3/21 0:16, Mathieu Poirier wrote:
> On Wed, 20 Mar 2019 at 00:37, Yue Haibing <yuehaibing@huawei.com> wrote:
>>
>> From: YueHaibing <yuehaibing@huawei.com>
>>
>> This patch series fixes two issue:
>> 1. fix pass-zero-to-ERR_PTR warning
>> 2. return correct errcode to upstream callers
>>
>> YueHaibing (2):
>>   perf cs-etm: Remove errnoeous ERR_PTR() usage in in
>>     cs_etm__process_auxtrace_info
>>   perf cs-etm: return errcode in cs_etm__process_auxtrace_info()
>>
>>  tools/perf/util/cs-etm.c | 12 ++++++++----
>>  1 file changed, 8 insertions(+), 4 deletions(-)
> 
> Please run your work through checkpatch and resend.
> 

Sorry, I will check and resend v2.

> Mathieu
> 
>>
>> --
>> 2.7.0
>>
>>
> 
> .
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-03-21  2:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-20  6:36 [PATCH 0/2] minor fixes for perf cs-etm Yue Haibing
2019-03-20  6:36 ` [PATCH 1/2] perf cs-etm: Remove errnoeous ERR_PTR() usage in in cs_etm__process_auxtrace_info Yue Haibing
2019-03-20  6:36 ` [PATCH 2/2] perf cs-etm: return errcode in cs_etm__process_auxtrace_info() Yue Haibing
2019-03-20 16:16 ` [PATCH 0/2] minor fixes for perf cs-etm Mathieu Poirier
2019-03-21  2:09   ` YueHaibing

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).