[PATCH] ASoC: au1x: fix error paths in ac97c/i2cs probe callbacks.

Manuel Lauss manuel.lauss at googlemail.com
Wed Oct 19 16:45:12 CEST 2011


add iounmap() and release the correct mem resource.

Signed-off-by: Manuel Lauss <manuel.lauss at googlemail.com>
---
 sound/soc/au1x/ac97c.c |    7 +++++--
 sound/soc/au1x/i2sc.c  |    7 +++++--
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/sound/soc/au1x/ac97c.c b/sound/soc/au1x/ac97c.c
index 13802ff..4ec39aa 100644
--- a/sound/soc/au1x/ac97c.c
+++ b/sound/soc/au1x/ac97c.c
@@ -251,12 +251,12 @@ static int __devinit au1xac97c_drvprobe(struct
platform_device *pdev)

 	r = platform_get_resource(pdev, IORESOURCE_DMA, 0);
 	if (!r)
-		goto out1;
+		goto out2;
 	ctx->dmaids[SNDRV_PCM_STREAM_PLAYBACK] = r->start;

 	r = platform_get_resource(pdev, IORESOURCE_DMA, 1);
 	if (!r)
-		goto out1;
+		goto out2;
 	ctx->dmaids[SNDRV_PCM_STREAM_CAPTURE] = r->start;

 	/* switch it on */
@@ -275,7 +275,10 @@ static int __devinit au1xac97c_drvprobe(struct
platform_device *pdev)
 	ac97c_workdata = ctx;
 	return 0;

+out2:
+	iounmap(ctx->mmio);
 out1:
+	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	release_mem_region(r->start, resource_size(r));
 out0:
 	kfree(ctx);
diff --git a/sound/soc/au1x/i2sc.c b/sound/soc/au1x/i2sc.c
index 19e0d2a..59fb31a 100644
--- a/sound/soc/au1x/i2sc.c
+++ b/sound/soc/au1x/i2sc.c
@@ -251,12 +251,12 @@ static int __devinit au1xi2s_drvprobe(struct
platform_device *pdev)

 	r = platform_get_resource(pdev, IORESOURCE_DMA, 0);
 	if (!r)
-		goto out1;
+		goto out2;
 	ctx->dmaids[SNDRV_PCM_STREAM_PLAYBACK] = r->start;

 	r = platform_get_resource(pdev, IORESOURCE_DMA, 1);
 	if (!r)
-		goto out1;
+		goto out2;
 	ctx->dmaids[SNDRV_PCM_STREAM_CAPTURE] = r->start;

 	platform_set_drvdata(pdev, ctx);
@@ -267,7 +267,10 @@ static int __devinit au1xi2s_drvprobe(struct
platform_device *pdev)

 	return 0;

+out2:
+	iounmap(ctx->mmio);
 out1:
+	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	release_mem_region(r->start, resource_size(r));
 out0:
 	kfree(ctx);
-- 
1.7.7


More information about the Alsa-devel mailing list