summaryrefslogtreecommitdiffstats
path: root/sound/soc/fsl/fsl_ssi.c
diff options
context:
space:
mode:
authorTimur Tabi <timur@freescale.com>2010-08-03 17:55:28 -0500
committerLiam Girdwood <lrg@slimlogic.co.uk>2010-08-12 14:00:17 +0100
commit87a0632b29410bab5c1783d7eb979c8d942d4209 (patch)
tree16762ec323b99ead5ab618b05ce99da234950800 /sound/soc/fsl/fsl_ssi.c
parent1a3c5a491af6756dbba6ee166a9dee72bb414ba8 (diff)
asoc/multi-component: fsl: fix exit and error paths in DMA and SSI drivers
The error handling code in the OF probe function of the SSI driver is not freeing all resources correctly. Since the machine driver no longer calls the DMA driver to provide information about the SSI, we don't need to keep a list of DMA objects any more. In addition, the fsl_soc_dma_remove() function is incorrectly removing *all* DMA objects when it should only remove one. Signed-off-by: Timur Tabi <timur@freescale.com> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
Diffstat (limited to 'sound/soc/fsl/fsl_ssi.c')
-rw-r--r--sound/soc/fsl/fsl_ssi.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index 51b089f9751..00e3e625b52 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -619,7 +619,7 @@ static int __devinit fsl_ssi_probe(struct of_device *of_dev,
{
struct fsl_ssi_private *ssi_private;
int ret = 0;
- struct device_attribute *dev_attr;
+ struct device_attribute *dev_attr = NULL;
struct device_node *np = of_dev->dev.of_node;
const char *p, *sprop;
struct resource res;
@@ -681,18 +681,16 @@ static int __devinit fsl_ssi_probe(struct of_device *of_dev,
if (ret) {
dev_err(&of_dev->dev, "could not create sysfs %s file\n",
ssi_private->dev_attr.attr.name);
- kfree(ssi_private);
- return ret;
+ goto error;
}
/* Register with ASoC */
dev_set_drvdata(&of_dev->dev, ssi_private);
ret = snd_soc_register_dai(&of_dev->dev, &ssi_private->cpu_dai_drv);
- if (ret != 0) {
+ if (ret) {
dev_err(&of_dev->dev, "failed to register DAI: %d\n", ret);
- kfree(ssi_private);
- return ret;
+ goto error;
}
/* Trigger the machine driver's probe function. The platform driver
@@ -713,18 +711,23 @@ static int __devinit fsl_ssi_probe(struct of_device *of_dev,
if (IS_ERR(ssi_private->pdev)) {
ret = PTR_ERR(ssi_private->pdev);
dev_err(&of_dev->dev, "failed to register platform: %d\n", ret);
- kfree(ssi_private);
- return ret;
+ goto error;
}
return 0;
+
+error:
+ snd_soc_unregister_dai(&of_dev->dev);
+ dev_set_drvdata(&of_dev->dev, NULL);
+ if (dev_attr)
+ device_remove_file(&of_dev->dev, dev_attr);
+ irq_dispose_mapping(ssi_private->irq);
+ iounmap(ssi_private->ssi);
+ kfree(ssi_private);
+
+ return ret;
}
-/**
- * fsl_ssi_destroy_dai: destroy the snd_soc_dai object
- *
- * This function undoes the operations of fsl_ssi_probe()
- */
static int fsl_ssi_remove(struct of_device *of_dev)
{
struct fsl_ssi_private *ssi_private = dev_get_drvdata(&of_dev->dev);