diff mbox series

[v1,2/3] ASoC: atmel: Fix error handling in at91samg20ek probe()

Message ID 20220325154241.1600757-3-broonie@kernel.org
State Accepted
Commit 28103509248b94392e04a8ffcbc47da5e3e31dfc
Headers show
Series ASoC: atmel: Fixes for AT91SAM9G20-EK audio driver | expand

Commit Message

Mark Brown March 25, 2022, 3:42 p.m. UTC
The error handling in the AT91SAM9G20-EK machine driver probe did not
consistently free the SSC in error paths, sometimes immediately returning
an error rather than doing cleanup. Fix this.

Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/atmel/sam9g20_wm8731.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

Comments

Codrin Ciubotariu April 4, 2022, 12:47 p.m. UTC | #1
On 25.03.2022 17:42, Mark Brown wrote:
> The error handling in the AT91SAM9G20-EK machine driver probe did not
> consistently free the SSC in error paths, sometimes immediately returning
> an error rather than doing cleanup. Fix this.
> 
> Signed-off-by: Mark Brown <broonie@kernel.org>

Should we have a 'Fixes' tag here?
Other than that:

Reviewed-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>

Thanks!
Mark Brown April 4, 2022, 1:23 p.m. UTC | #2
On Mon, Apr 04, 2022 at 12:47:27PM +0000, Codrin.Ciubotariu@microchip.com wrote:
> On 25.03.2022 17:42, Mark Brown wrote:
> > The error handling in the AT91SAM9G20-EK machine driver probe did not
> > consistently free the SSC in error paths, sometimes immediately returning
> > an error rather than doing cleanup. Fix this.
> > 
> > Signed-off-by: Mark Brown <broonie@kernel.org>
> 
> Should we have a 'Fixes' tag here?

I'm not sure those code paths are ever executing, I really don't think
it's worth the effort or noise checking.
diff mbox series

Patch

diff --git a/sound/soc/atmel/sam9g20_wm8731.c b/sound/soc/atmel/sam9g20_wm8731.c
index 0d639a33ad96..d771843011ea 100644
--- a/sound/soc/atmel/sam9g20_wm8731.c
+++ b/sound/soc/atmel/sam9g20_wm8731.c
@@ -148,7 +148,8 @@  static int at91sam9g20ek_audio_probe(struct platform_device *pdev)
 	codec_np = of_parse_phandle(np, "atmel,audio-codec", 0);
 	if (!codec_np) {
 		dev_err(&pdev->dev, "codec info missing\n");
-		return -EINVAL;
+		ret = -EINVAL;
+		goto err;
 	}
 	at91sam9g20ek_dai.codecs->of_node = codec_np;
 
@@ -159,7 +160,8 @@  static int at91sam9g20ek_audio_probe(struct platform_device *pdev)
 	if (!cpu_np) {
 		dev_err(&pdev->dev, "dai and pcm info missing\n");
 		of_node_put(codec_np);
-		return -EINVAL;
+		ret = -EINVAL;
+		goto err;
 	}
 	at91sam9g20ek_dai.cpus->of_node = cpu_np;
 	at91sam9g20ek_dai.platforms->of_node = cpu_np;
@@ -170,9 +172,10 @@  static int at91sam9g20ek_audio_probe(struct platform_device *pdev)
 	ret = snd_soc_register_card(card);
 	if (ret) {
 		dev_err(&pdev->dev, "snd_soc_register_card() failed\n");
+		goto err;
 	}
 
-	return ret;
+	return 0;
 
 err:
 	atmel_ssc_put_audio(0);