提交 235c3b28 编写于 作者: C Christophe JAILLET 提交者: Zheng Zengkai

ASoC: wcd9335: Fix a memory leak in the error handling path of the probe function

stable inclusion
from stable-5.10.65
commit 729a459efd30dbb8d57410560d8eafe1268e3d63
bugzilla: 182361 https://gitee.com/openeuler/kernel/issues/I4EH3U

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=729a459efd30dbb8d57410560d8eafe1268e3d63

--------------------------------

[ Upstream commit fc6fc81c ]

If 'wcd9335_setup_irqs()' fails, me must release the memory allocated in
'wcd_clsh_ctrl_alloc()', as already done in the remove function.

Add an error handling path and the missing 'wcd_clsh_ctrl_free()' call.

Fixes: 20aedafd ("ASoC: wcd9335: add support to wcd9335 codec")
Signed-off-by: NChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Message-Id: <6dc12372f09fabb70bf05941dbe6a1382dc93e43.1629091028.git.christophe.jaillet@wanadoo.fr>
Signed-off-by: NMark Brown <broonie@kernel.org>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Acked-by: NWeilong Chen <chenweilong@huawei.com>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 230ff97a
......@@ -4844,6 +4844,7 @@ static void wcd9335_codec_init(struct snd_soc_component *component)
static int wcd9335_codec_probe(struct snd_soc_component *component)
{
struct wcd9335_codec *wcd = dev_get_drvdata(component->dev);
int ret;
int i;
snd_soc_component_init_regmap(component, wcd->regmap);
......@@ -4861,7 +4862,15 @@ static int wcd9335_codec_probe(struct snd_soc_component *component)
for (i = 0; i < NUM_CODEC_DAIS; i++)
INIT_LIST_HEAD(&wcd->dai[i].slim_ch_list);
return wcd9335_setup_irqs(wcd);
ret = wcd9335_setup_irqs(wcd);
if (ret)
goto free_clsh_ctrl;
return 0;
free_clsh_ctrl:
wcd_clsh_ctrl_free(wcd->clsh_ctrl);
return ret;
}
static void wcd9335_codec_remove(struct snd_soc_component *comp)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册