diff mbox series

[v7,08/25] coresight: etm: perf: Fix warning caused by etm_setup_aux failure

Message ID 20200805025458.2978-9-tingwei@codeaurora.org (mailing list archive)
State New, archived
Headers show
Series coresight: allow to build coresight as modules | expand

Commit Message

Tingwei Zhang Aug. 5, 2020, 2:54 a.m. UTC
When coresight_build_path() fails on all the cpus, etm_setup_aux
calls etm_free_aux() to free allocated event_data.
WARN_ON(cpumask_empty(mask) will be triggered since cpu mask is empty.
Check event_data->snk_config is not NULL first to avoid this
warning.

Signed-off-by: Tingwei Zhang <tingwei@codeaurora.org>
Reviewed-by: Mike Leach <mike.leach@linaro.org>
---
 drivers/hwtracing/coresight/coresight-etm-perf.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Suzuki K Poulose Aug. 5, 2020, 10:18 a.m. UTC | #1
On 08/05/2020 03:54 AM, Tingwei Zhang wrote:
> When coresight_build_path() fails on all the cpus, etm_setup_aux
> calls etm_free_aux() to free allocated event_data.
> WARN_ON(cpumask_empty(mask) will be triggered since cpu mask is empty.
> Check event_data->snk_config is not NULL first to avoid this
> warning.
> 
> Signed-off-by: Tingwei Zhang <tingwei@codeaurora.org>
> Reviewed-by: Mike Leach <mike.leach@linaro.org>

Please could you added a Fixes tag for this ?

Fixes: f5200aa9831f38 ("coresight: perf: Refactor function 
free_event_data()")

Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>

> ---
>   drivers/hwtracing/coresight/coresight-etm-perf.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.c b/drivers/hwtracing/coresight/coresight-etm-perf.c
> index dcb0592418ae..3728c44e5763 100644
> --- a/drivers/hwtracing/coresight/coresight-etm-perf.c
> +++ b/drivers/hwtracing/coresight/coresight-etm-perf.c
> @@ -126,10 +126,10 @@ static void free_sink_buffer(struct etm_event_data *event_data)
>   	cpumask_t *mask = &event_data->mask;
>   	struct coresight_device *sink;
>   
> -	if (WARN_ON(cpumask_empty(mask)))
> +	if (!event_data->snk_config)
>   		return;
>   
> -	if (!event_data->snk_config)
> +	if (WARN_ON(cpumask_empty(mask)))
>   		return;


>   
>   	cpu = cpumask_first(mask);
>
Tingwei Zhang Aug. 6, 2020, 2:46 a.m. UTC | #2
On Wed, Aug 05, 2020 at 06:18:35PM +0800, Suzuki K Poulose wrote:
> On 08/05/2020 03:54 AM, Tingwei Zhang wrote:
> >When coresight_build_path() fails on all the cpus, etm_setup_aux
> >calls etm_free_aux() to free allocated event_data.
> >WARN_ON(cpumask_empty(mask) will be triggered since cpu mask is empty.
> >Check event_data->snk_config is not NULL first to avoid this
> >warning.
> >
> >Signed-off-by: Tingwei Zhang <tingwei@codeaurora.org>
> >Reviewed-by: Mike Leach <mike.leach@linaro.org>
> 
> Please could you added a Fixes tag for this ?
> 
> Fixes: f5200aa9831f38 ("coresight: perf: Refactor function
> free_event_data()")
> 
I'll add Fixes tag.

Thanks,
Tingwei
> Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
> 
> >---
> >  drivers/hwtracing/coresight/coresight-etm-perf.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> >diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.c
> >b/drivers/hwtracing/coresight/coresight-etm-perf.c
> >index dcb0592418ae..3728c44e5763 100644
> >--- a/drivers/hwtracing/coresight/coresight-etm-perf.c
> >+++ b/drivers/hwtracing/coresight/coresight-etm-perf.c
> >@@ -126,10 +126,10 @@ static void free_sink_buffer(struct etm_event_data
> >*event_data)
> >  	cpumask_t *mask = &event_data->mask;
> >  	struct coresight_device *sink;
> >
> >-	if (WARN_ON(cpumask_empty(mask)))
> >+	if (!event_data->snk_config)
> >  		return;
> >
> >-	if (!event_data->snk_config)
> >+	if (WARN_ON(cpumask_empty(mask)))
> >  		return;
> 
> 
> >
> >  	cpu = cpumask_first(mask);
> >
>
diff mbox series

Patch

diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.c b/drivers/hwtracing/coresight/coresight-etm-perf.c
index dcb0592418ae..3728c44e5763 100644
--- a/drivers/hwtracing/coresight/coresight-etm-perf.c
+++ b/drivers/hwtracing/coresight/coresight-etm-perf.c
@@ -126,10 +126,10 @@  static void free_sink_buffer(struct etm_event_data *event_data)
 	cpumask_t *mask = &event_data->mask;
 	struct coresight_device *sink;
 
-	if (WARN_ON(cpumask_empty(mask)))
+	if (!event_data->snk_config)
 		return;
 
-	if (!event_data->snk_config)
+	if (WARN_ON(cpumask_empty(mask)))
 		return;
 
 	cpu = cpumask_first(mask);