From: Chunyan Zhang Date: Mon, 15 Feb 2016 17:11:52 +0000 (+0200) Subject: stm class: Fix master deallocation in device unregistering X-Git-Tag: next-20160301~20^2~142^2~40 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=73a3ed1903f7611f62fb5e1cd3c37afd2908e669;p=karo-tx-linux.git 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 [alexander.shishkin@intel.com: re-wrote the commit message] Signed-off-by: Alexander Shishkin Signed-off-by: Greg Kroah-Hartman --- 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);