Skip to content

Commit 52c64e5

Browse files
committed
Merge series "ASoC: wcd9335: Firx some resources leak in the probe and remove function" from Christophe JAILLET <[email protected]>:
The first 2 patches are sraightforward and look logical to me. However, the 3rd one in purely speculative. It is based on the fact that a comment states that we enable some irqs on some slave ports. That said, it writes 0xFF in some registers. So, I guess that we should disable these irqs when the driver is removed. That said, writing 0x00 at the same place looks logical to me. This cis untested and NOT based on any documentation. Just a blind fix. Review with care. You'll be warned :) Christophe JAILLET (3): ASoC: wcd9335: Fix a double irq free in the remove function ASoC: wcd9335: Fix a memory leak in the error handling path of the probe function ASoC: wcd9335: Disable irq on slave ports in the remove function sound/soc/codecs/wcd9335.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) -- 2.30.2
2 parents 6479f75 + d3efd26 commit 52c64e5

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

sound/soc/codecs/wcd9335.c

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4076,6 +4076,16 @@ static int wcd9335_setup_irqs(struct wcd9335_codec *wcd)
40764076
return ret;
40774077
}
40784078

4079+
static void wcd9335_teardown_irqs(struct wcd9335_codec *wcd)
4080+
{
4081+
int i;
4082+
4083+
/* disable interrupts on all slave ports */
4084+
for (i = 0; i < WCD9335_SLIM_NUM_PORT_REG; i++)
4085+
regmap_write(wcd->if_regmap, WCD9335_SLIM_PGD_PORT_INT_EN0 + i,
4086+
0x00);
4087+
}
4088+
40794089
static void wcd9335_cdc_sido_ccl_enable(struct wcd9335_codec *wcd,
40804090
bool ccl_flag)
40814091
{
@@ -4844,6 +4854,7 @@ static void wcd9335_codec_init(struct snd_soc_component *component)
48444854
static int wcd9335_codec_probe(struct snd_soc_component *component)
48454855
{
48464856
struct wcd9335_codec *wcd = dev_get_drvdata(component->dev);
4857+
int ret;
48474858
int i;
48484859

48494860
snd_soc_component_init_regmap(component, wcd->regmap);
@@ -4861,15 +4872,23 @@ static int wcd9335_codec_probe(struct snd_soc_component *component)
48614872
for (i = 0; i < NUM_CODEC_DAIS; i++)
48624873
INIT_LIST_HEAD(&wcd->dai[i].slim_ch_list);
48634874

4864-
return wcd9335_setup_irqs(wcd);
4875+
ret = wcd9335_setup_irqs(wcd);
4876+
if (ret)
4877+
goto free_clsh_ctrl;
4878+
4879+
return 0;
4880+
4881+
free_clsh_ctrl:
4882+
wcd_clsh_ctrl_free(wcd->clsh_ctrl);
4883+
return ret;
48654884
}
48664885

48674886
static void wcd9335_codec_remove(struct snd_soc_component *comp)
48684887
{
48694888
struct wcd9335_codec *wcd = dev_get_drvdata(comp->dev);
48704889

48714890
wcd_clsh_ctrl_free(wcd->clsh_ctrl);
4872-
free_irq(regmap_irq_get_virq(wcd->irq_data, WCD9335_IRQ_SLIMBUS), wcd);
4891+
wcd9335_teardown_irqs(wcd);
48734892
}
48744893

48754894
static int wcd9335_codec_set_sysclk(struct snd_soc_component *comp,

0 commit comments

Comments
 (0)