Skip to contentSkip to conversation

sound/soc/meson: fix irq leak in error path

PATCH In review Pavel Machek 3 participants 3 messages Mar 9, 2020

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sound/soc/meson: fix irq leak in error path

Irq seems to be leaked in error path. Fix that.

---

I noticed problem during -stable review, and don't have hardware or ability to test the patch. Handle with care.

sound/soc/meson/axg-fifo.c +8 -2
index 2f44e93359f6..fbac6de891cd 100644
@@ -249,7 +249,7 @@ int axg_fifo_pcm_open(struct snd_soc_component *component,
 	/* Enable pclk to access registers and clock the fifo ip */
 	ret = clk_prepare_enable(fifo->pclk);
 	if (ret)
-		return ret;
+		goto free_irq;
 
 	/* Setup status2 so it reports the memory pointer */
 	regmap_update_bits(fifo->map, FIFO_CTRL1,
@@ -270,8 +269,14 @@ int axg_fifo_pcm_open(struct snd_soc_component *component,
 	/* Take memory arbitror out of reset */
 	ret = reset_control_deassert(fifo->arb);
 	if (ret)
-		clk_disable_unprepare(fifo->pclk);
+		goto free_clk;
+
+	return 0;
 
+free_clk:
+	clk_disable_unprepare(fifo->pclk);
+free_irq:
+	free_irq(fifo->irq, ss);
 	return ret;
 }
 EXPORT_SYMBOL_GPL(axg_fifo_pcm_open);
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
maintainer
#1 lore raw
Quoted 2 lines · Pavel Machek

Irq seems to be leaked in error path. Fix that.

Thanks for fixing this.

the Fixes tag is missing here.

Fixes 6dc4fa179fb8 ("ASoC: meson: add axg fifo base driver")
Quoted 21 lines

---

I noticed problem during -stable review, and don't have hardware or ability to test the patch. Handle with care.

sound/soc/meson/axg-fifo.c +1 -1
index 2f44e93359f6..fbac6de891cd 100644
@@ -249,7 +249,7 @@ int axg_fifo_pcm_open(struct snd_soc_component *component,
 	/* Enable pclk to access registers and clock the fifo ip */
 	ret = clk_prepare_enable(fifo->pclk);
 	if (ret)
-		return ret;
+		goto free_irq;
 
 	/* Setup status2 so it reports the memory pointer */
 	regmap_update_bits(fifo->map, FIFO_CTRL1,

sound/soc/meson/axg-fifo.c int axg_fifo_pcm_open(struct snd_soc_component *component, · line 276

Quoted 9 lines
sound/soc/meson/axg-fifo.c +4 -1
@@ -270,8 +269,14 @@ int axg_fifo_pcm_open(struct snd_soc_component *component,
 	/* Take memory arbitror out of reset */
 	ret = reset_control_deassert(fifo->arb);
 	if (ret)
-		clk_disable_unprepare(fifo->pclk);
+		goto free_clk;
+
+	return 0;
 
+free_clk:

This label is misleading as it won't free the clock but turn it off. how about 'err_rst' ?

sound/soc/meson/axg-fifo.c int axg_fifo_pcm_open(struct snd_soc_component *component, · line 278

Quoted 2 lines
sound/soc/meson/axg-fifo.c +2 -0
+	clk_disable_unprepare(fifo->pclk);
+free_irq:

and 'err_pclk' here ?

Quoted 4 lines
sound/soc/meson/axg-fifo.c +1 -0
+	free_irq(fifo->irq, ss);
 	return ret;
 }
 EXPORT_SYMBOL_GPL(axg_fifo_pcm_open);
maintainer
#2 lore raw
In reply to Pavel Machek
Quoted 1 line · Pavel Machek

Irq seems to be leaked in error path. Fix that.

Please submit patches using subject lines reflecting the style for the subsystem, this makes it easier for people to identify relevant patches. Look at what existing commits in the area you're changing are doing and make sure your subject lines visually resemble what they're doing. There's no need to resubmit to fix this alone.