Skip to contentSkip to conversation

stm class: Fix channel free in stm output free path

PATCH In review Sai Prakash Ranjan 3 participants 3 messages Apr 5, 2019

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 stm class: Fix channel free in stm output free path

From: Tingwei Zhang <[email protected]>

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")
---
 drivers/hwtracing/stm/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwtracing/stm/core.c +1 -1
index c7ba8acfd4d5..5b5807cbcf7c 100644
@@ -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;
 }
 
 /*
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation
Reviewed-by on v1 1/1
#1 lore raw
Quoted 23 lines · Sai Prakash Ranjan

From: Tingwei Zhang <[email protected]>

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")
---
  drivers/hwtracing/stm/core.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwtracing/stm/core.c +0 -0
index c7ba8acfd4d5..5b5807cbcf7c 100644

drivers/hwtracing/stm/core.c stm_output_disclaim(struct stm_device *stm, struct stm_output *output) · line 222

Quoted 6 lines
drivers/hwtracing/stm/core.c +1 -1
@@ -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;
#2 lore raw
In reply to Sai Prakash Ranjan
Quoted 9 lines · Sai Prakash Ranjan

From: Tingwei Zhang <[email protected]>

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!