diff mbox series

ASoC: codecs: wm0010: Fix error handling path in wm0010_spi_probe()

Message ID ee39ba19b8c4c157ce04e06096a8f54016831959.1741549792.git.christophe.jaillet@wanadoo.fr (mailing list archive)
State Superseded
Headers show
Series ASoC: codecs: wm0010: Fix error handling path in wm0010_spi_probe() | expand

Commit Message

Christophe JAILLET March 9, 2025, 7:50 p.m. UTC
Free some resources in the error handling path of the probe, as already
done in the remove function.

Fixes: e3523e01869d ("ASoC: wm0010: Add initial wm0010 DSP driver")
Fixes: fd8b96574456 ("ASoC: wm0010: Clear IRQ as wake source and include missing header")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Compile tested-only
---
 sound/soc/codecs/wm0010.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

Comments

Amadeusz Sławiński March 10, 2025, 7:49 a.m. UTC | #1
On 3/9/2025 8:50 PM, Christophe JAILLET wrote:
> Free some resources in the error handling path of the probe, as already
> done in the remove function.
> 
> Fixes: e3523e01869d ("ASoC: wm0010: Add initial wm0010 DSP driver")
> Fixes: fd8b96574456 ("ASoC: wm0010: Clear IRQ as wake source and include missing header")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> Compile tested-only
> ---
>   sound/soc/codecs/wm0010.c | 13 +++++++++++--
>   1 file changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/sound/soc/codecs/wm0010.c b/sound/soc/codecs/wm0010.c
> index edd2cb185c42..28b43fe4dc32 100644
> --- a/sound/soc/codecs/wm0010.c
> +++ b/sound/soc/codecs/wm0010.c
> @@ -920,7 +920,7 @@ static int wm0010_spi_probe(struct spi_device *spi)
>   	if (ret) {
>   		dev_err(wm0010->dev, "Failed to set IRQ %d as wake source: %d\n",
>   			irq, ret);
> -		return ret;
> +		goto free_riq;

typo? riq -> irq

>   	}
>   
>   	if (spi->max_speed_hz)
> @@ -932,9 +932,18 @@ static int wm0010_spi_probe(struct spi_device *spi)
>   				     &soc_component_dev_wm0010, wm0010_dai,
>   				     ARRAY_SIZE(wm0010_dai));
>   	if (ret < 0)
> -		return ret;
> +		goto disable_irq_wake;
>   
>   	return 0;
> +
> +disable_irq_wake:
> +	irq_set_irq_wake(wm0010->irq, 0);
> +
> +free_riq:
> +	if (wm0010->irq)
> +		free_irq(wm0010->irq, wm0010);
> +
> +	return ret;
>   }
>   
>   static void wm0010_spi_remove(struct spi_device *spi)
diff mbox series

Patch

diff --git a/sound/soc/codecs/wm0010.c b/sound/soc/codecs/wm0010.c
index edd2cb185c42..28b43fe4dc32 100644
--- a/sound/soc/codecs/wm0010.c
+++ b/sound/soc/codecs/wm0010.c
@@ -920,7 +920,7 @@  static int wm0010_spi_probe(struct spi_device *spi)
 	if (ret) {
 		dev_err(wm0010->dev, "Failed to set IRQ %d as wake source: %d\n",
 			irq, ret);
-		return ret;
+		goto free_riq;
 	}
 
 	if (spi->max_speed_hz)
@@ -932,9 +932,18 @@  static int wm0010_spi_probe(struct spi_device *spi)
 				     &soc_component_dev_wm0010, wm0010_dai,
 				     ARRAY_SIZE(wm0010_dai));
 	if (ret < 0)
-		return ret;
+		goto disable_irq_wake;
 
 	return 0;
+
+disable_irq_wake:
+	irq_set_irq_wake(wm0010->irq, 0);
+
+free_riq:
+	if (wm0010->irq)
+		free_irq(wm0010->irq, wm0010);
+
+	return ret;
 }
 
 static void wm0010_spi_remove(struct spi_device *spi)