Skip to content

Commit fc6fc81

Browse files
tititiou36broonie
authored andcommitted
ASoC: wcd9335: Fix a memory leak in the error handling path of the probe function
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: 20aedaf ("ASoC: wcd9335: add support to wcd9335 codec") Signed-off-by: Christophe JAILLET <[email protected]> Message-Id: <6dc12372f09fabb70bf05941dbe6a1382dc93e43.1629091028.git.christophe.jaillet@wanadoo.fr> Signed-off-by: Mark Brown <[email protected]>
1 parent 7a6a723 commit fc6fc81

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

sound/soc/codecs/wcd9335.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4844,6 +4844,7 @@ static void wcd9335_codec_init(struct snd_soc_component *component)
48444844
static int wcd9335_codec_probe(struct snd_soc_component *component)
48454845
{
48464846
struct wcd9335_codec *wcd = dev_get_drvdata(component->dev);
4847+
int ret;
48474848
int i;
48484849

48494850
snd_soc_component_init_regmap(component, wcd->regmap);
@@ -4861,7 +4862,15 @@ static int wcd9335_codec_probe(struct snd_soc_component *component)
48614862
for (i = 0; i < NUM_CODEC_DAIS; i++)
48624863
INIT_LIST_HEAD(&wcd->dai[i].slim_ch_list);
48634864

4864-
return wcd9335_setup_irqs(wcd);
4865+
ret = wcd9335_setup_irqs(wcd);
4866+
if (ret)
4867+
goto free_clsh_ctrl;
4868+
4869+
return 0;
4870+
4871+
free_clsh_ctrl:
4872+
wcd_clsh_ctrl_free(wcd->clsh_ctrl);
4873+
return ret;
48654874
}
48664875

48674876
static void wcd9335_codec_remove(struct snd_soc_component *comp)

0 commit comments

Comments
 (0)