summaryrefslogtreecommitdiff
path: root/drivers/hwtracing/stm
diff options
context:
space:
mode:
authorChunyan Zhang <zhang.chunyan@linaro.org>2016-02-15 20:11:52 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-02-21 01:09:14 +0300
commit73a3ed1903f7611f62fb5e1cd3c37afd2908e669 (patch)
treef454462a7577934ea4b2167e816f9c65c629d9a9 /drivers/hwtracing/stm
parentf45f40ad65336699757af948b81414c5999f1d48 (diff)
downloadlinux-73a3ed1903f7611f62fb5e1cd3c37afd2908e669.tar.xz
stm class: Fix master deallocation in device unregistering
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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/hwtracing/stm')
-rw-r--r--drivers/hwtracing/stm/core.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/hwtracing/stm/core.c b/drivers/hwtracing/stm/core.c
index cdec240bd6b6..79cca94bfb58 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)
stp_policy_unbind(stm->policy);
mutex_unlock(&stm->policy_mutex);
- 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);
device_unregister(&stm->dev);