linux-amlogic.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sound/soc/meson: fix irq leak in error path
@ 2020-03-09 16:29 Pavel Machek
  2020-03-09 16:46 ` Jerome Brunet
  2020-03-09 16:59 ` Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Pavel Machek @ 2020-03-09 16:29 UTC (permalink / raw)
  To: jbrunet, lgirdwood, broonie, perex, tiwai, khilman,
	linux-amlogic, linux-kernel


[-- Attachment #1.1: Type: text/plain, Size: 1283 bytes --]

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

Signed-off-by: Pavel Machek <pavel@denx.de>

---

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

diff --git a/sound/soc/meson/axg-fifo.c b/sound/soc/meson/axg-fifo.c
index 2f44e93359f6..fbac6de891cd 100644
--- a/sound/soc/meson/axg-fifo.c
+++ b/sound/soc/meson/axg-fifo.c
@@ -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);

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

[-- Attachment #2: Type: text/plain, Size: 167 bytes --]

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] sound/soc/meson: fix irq leak in error path
  2020-03-09 16:29 [PATCH] sound/soc/meson: fix irq leak in error path Pavel Machek
@ 2020-03-09 16:46 ` Jerome Brunet
  2020-03-09 16:59 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Jerome Brunet @ 2020-03-09 16:46 UTC (permalink / raw)
  To: Pavel Machek, lgirdwood, broonie, perex, tiwai, khilman,
	linux-amlogic, linux-kernel


On Mon 09 Mar 2020 at 17:29, Pavel Machek <pavel@ucw.cz> wrote:

> 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")

> Signed-off-by: Pavel Machek <pavel@denx.de>
>
> ---
>
> I noticed problem during -stable review, and don't have hardware or
> ability to test the patch. Handle with care.
>
> diff --git a/sound/soc/meson/axg-fifo.c b/sound/soc/meson/axg-fifo.c
> index 2f44e93359f6..fbac6de891cd 100644
> --- a/sound/soc/meson/axg-fifo.c
> +++ b/sound/soc/meson/axg-fifo.c
> @@ -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:

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

> +	clk_disable_unprepare(fifo->pclk);
> +free_irq:

and 'err_pclk' here ?

> +	free_irq(fifo->irq, ss);
>  	return ret;
>  }
>  EXPORT_SYMBOL_GPL(axg_fifo_pcm_open);


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] sound/soc/meson: fix irq leak in error path
  2020-03-09 16:29 [PATCH] sound/soc/meson: fix irq leak in error path Pavel Machek
  2020-03-09 16:46 ` Jerome Brunet
@ 2020-03-09 16:59 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2020-03-09 16:59 UTC (permalink / raw)
  To: Pavel Machek
  Cc: lgirdwood, khilman, tiwai, perex, linux-amlogic, linux-kernel, jbrunet


[-- Attachment #1.1: Type: text/plain, Size: 443 bytes --]

On Mon, Mar 09, 2020 at 05:29:12PM +0100, Pavel Machek wrote:
> 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.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 167 bytes --]

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-03-09 16:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-09 16:29 [PATCH] sound/soc/meson: fix irq leak in error path Pavel Machek
2020-03-09 16:46 ` Jerome Brunet
2020-03-09 16:59 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).