[alsa-devel] [PATCH] ASoC: fsl: imx-sgtl5000: fix error path if codec driver not found

Andrew Gabbasov andrew_gabbasov at mentor.com
Thu Sep 19 14:52:25 CEST 2013


Handling of this error condition should make some cleanup on function exit
instead of immediate return.

Signed-off-by: Andrew Gabbasov <andrew_gabbasov at mentor.com>
---
 sound/soc/fsl/imx-sgtl5000.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sound/soc/fsl/imx-sgtl5000.c b/sound/soc/fsl/imx-sgtl5000.c
index 46c5b4f..7ea5658 100644
--- a/sound/soc/fsl/imx-sgtl5000.c
+++ b/sound/soc/fsl/imx-sgtl5000.c
@@ -119,7 +119,8 @@ static int imx_sgtl5000_probe(struct platform_device *pdev)
 	codec_dev = of_find_i2c_device_by_node(codec_np);
 	if (!codec_dev) {
 		dev_err(&pdev->dev, "failed to find codec platform device\n");
-		return -EPROBE_DEFER;
+		ret = -EPROBE_DEFER;
+		goto fail;
 	}
 
 	data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
-- 
1.7.10.4



More information about the Alsa-devel mailing list