[02/20] stm class: Fix master deallocation in device unregistering

Message ID 1455556330-12473-3-git-send-email-alexander.shishkin@linux.intel.com
State New
Headers show

Commit Message

Alexander Shishkin Feb. 15, 2016, 5:11 p.m.
From: Chunyan Zhang <zhang.chunyan@linaro.org>

The device unregister path uses wrong master index range when it tries
to free the allocated masters, it should, as does the rest of the stm
class code, use real master IDs.

This patch fixes the device unregister path to use real master IDs to
avoid memory leaks after unloading the stm driver.

Signed-off-by: Chunyan Zhang <zhang.chunyan@linaro.org>

[alexander.shishkin@intel.com: re-wrote the commit message]
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>

 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 cdec240bd6..79cca94bfb 100644
--- a/drivers/hwtracing/stm/core.c
+++ b/drivers/hwtracing/stm/core.c
@@ -690,7 +690,7 @@  void stm_unregister_device(struct stm_data *stm_data)
-	for (i = 0; i < stm->sw_nmasters; i++)
+	for (i = stm->data->sw_start; i <= stm->data->sw_end; i++)
 		stp_master_free(stm, i);