clear-pkgs-linux-iot-lts2018/1047-SoC-Intel-Fix-memory-l...

50 lines
1.7 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Anil Kumar <anil.kumar.k@intel.com>
Date: Thu, 21 Mar 2019 13:55:05 -0700
Subject: [PATCH] SoC: Intel: Fix memory leak cnl_sdw_bra_pipe_cfg_pb function
This fix takes care of cases where host|link_cpr_cfg->id.pvt_id
is < 0. We now flow down into the error label to properly free
the dynamically allocated memory.
Tracked-On: PKT-1810
Signed-off-by: Anil Kumar <anil.kumar.k@intel.com>
---
sound/soc/intel/skylake/skl-messages.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/sound/soc/intel/skylake/skl-messages.c b/sound/soc/intel/skylake/skl-messages.c
index 9f70a4f7f252..719725f84aab 100644
--- a/sound/soc/intel/skylake/skl-messages.c
+++ b/sound/soc/intel/skylake/skl-messages.c
@@ -462,8 +462,10 @@ static int cnl_sdw_bra_pipe_cfg_pb(struct skl_sst *ctx,
host_cpr_cfg->id.instance_id = 1;
host_cpr_cfg->id.pvt_id = skl_get_pvt_id(ctx,
(uuid_le *)host_cpr_cfg->guid, host_cpr_cfg->id.instance_id);
- if (host_cpr_cfg->id.pvt_id < 0)
- return -EINVAL;
+ if (host_cpr_cfg->id.pvt_id < 0) {
+ ret = -EINVAL;
+ goto error;
+ }
host_cpr_cfg->module->resources[0].cps = 100000;
host_cpr_cfg->module->resources[0].is_pages = 0;
@@ -722,8 +724,10 @@ static int cnl_sdw_bra_pipe_cfg_cp(struct skl_sst *ctx,
link_cpr_cfg->id.instance_id = 3;
link_cpr_cfg->id.pvt_id = skl_get_pvt_id(ctx,
(uuid_le *)link_cpr_cfg->guid, link_cpr_cfg->id.instance_id);
- if (link_cpr_cfg->id.pvt_id < 0)
- return -EINVAL;
+ if (link_cpr_cfg->id.pvt_id < 0) {
+ ret = -EINVAL;
+ goto error;
+ }
link_cpr_cfg->module->resources[0].cps = 100000;
link_cpr_cfg->module->resources[0].is_pages = 0;
--
https://clearlinux.org