diff mbox series

stm class: Fix channel free in stm output free path

Message ID 20190405102442.25718-1-saiprakash.ranjan@codeaurora.org (mailing list archive)
State New, archived
Headers show
Series stm class: Fix channel free in stm output free path | expand

Commit Message

Sai Prakash Ranjan April 5, 2019, 10:24 a.m. UTC
From: Tingwei Zhang <tingwei@codeaurora.org>

Number of free masters is not set correctly in stm
free path. Fix this by properly adding the number
of output channels before setting them to 0 in
stm_output_disclaim().

Currently it is equivalent to doing nothing since
master->nr_free is incremented by 0.

Fixes: 7bd1d4093c2f ("stm class: Introduce an abstraction for System Trace Module devices")
Signed-off-by: Tingwei Zhang <tingwei@codeaurora.org>
Signed-off-by: Sai Prakash Ranjan <saiprakash.ranjan@codeaurora.org>
Cc: stable@vger.kernel.org
---
 drivers/hwtracing/stm/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Suzuki K Poulose April 5, 2019, 10:32 a.m. UTC | #1
On 05/04/2019 11:24, Sai Prakash Ranjan wrote:
> From: Tingwei Zhang <tingwei@codeaurora.org>
> 
> Number of free masters is not set correctly in stm
> free path. Fix this by properly adding the number
> of output channels before setting them to 0 in
> stm_output_disclaim().
> 
> Currently it is equivalent to doing nothing since
> master->nr_free is incremented by 0.
> 
> Fixes: 7bd1d4093c2f ("stm class: Introduce an abstraction for System Trace Module devices")
> Signed-off-by: Tingwei Zhang <tingwei@codeaurora.org>
> Signed-off-by: Sai Prakash Ranjan <saiprakash.ranjan@codeaurora.org>
> Cc: stable@vger.kernel.org
> ---
>   drivers/hwtracing/stm/core.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/hwtracing/stm/core.c b/drivers/hwtracing/stm/core.c
> index c7ba8acfd4d5..5b5807cbcf7c 100644
> --- a/drivers/hwtracing/stm/core.c
> +++ b/drivers/hwtracing/stm/core.c
> @@ -218,8 +218,8 @@ stm_output_disclaim(struct stm_device *stm, struct stm_output *output)
>   	bitmap_release_region(&master->chan_map[0], output->channel,
>   			      ilog2(output->nr_chans));
>   
> -	output->nr_chans = 0;
>   	master->nr_free += output->nr_chans;
> +	output->nr_chans = 0;

Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Alexander Shishkin April 5, 2019, 10:36 a.m. UTC | #2
Sai Prakash Ranjan <saiprakash.ranjan@codeaurora.org> writes:

> From: Tingwei Zhang <tingwei@codeaurora.org>
>
> Number of free masters is not set correctly in stm
> free path. Fix this by properly adding the number
> of output channels before setting them to 0 in
> stm_output_disclaim().
>
> Currently it is equivalent to doing nothing since
> master->nr_free is incremented by 0.

Good catch, thank you!
diff mbox series

Patch

diff --git a/drivers/hwtracing/stm/core.c b/drivers/hwtracing/stm/core.c
index c7ba8acfd4d5..5b5807cbcf7c 100644
--- a/drivers/hwtracing/stm/core.c
+++ b/drivers/hwtracing/stm/core.c
@@ -218,8 +218,8 @@  stm_output_disclaim(struct stm_device *stm, struct stm_output *output)
 	bitmap_release_region(&master->chan_map[0], output->channel,
 			      ilog2(output->nr_chans));
 
-	output->nr_chans = 0;
 	master->nr_free += output->nr_chans;
+	output->nr_chans = 0;
 }
 
 /*