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>
diff --git a/sound/soc/fsl/fsl_dma.c b/sound/soc/fsl/fsl_dma.c
index 4450f9d..57774cb 100644
--- a/sound/soc/fsl/fsl_dma.c
+++ b/sound/soc/fsl/fsl_dma.c
@@ -57,7 +57,6 @@
SNDRV_PCM_RATE_CONTINUOUS)
struct dma_object {
- struct list_head list;
struct snd_soc_platform_driver dai;
dma_addr_t ssi_stx_phys;
dma_addr_t ssi_srx_phys;
@@ -825,9 +824,6 @@
}
}
-/* List of DMA nodes that we've probed */
-static LIST_HEAD(dma_list);
-
/**
* find_ssi_node -- returns the SSI node that points to his DMA channel node
*
@@ -915,25 +911,20 @@
dma->channel = of_iomap(np, 0);
dma->irq = irq_of_parse_and_map(np, 0);
- list_add(&dma->list, &dma_list);
+
+ dev_set_drvdata(&of_dev->dev, dma);
return 0;
}
static int __devexit fsl_soc_dma_remove(struct of_device *of_dev)
{
- struct list_head *n, *ptr;
- struct dma_object *dma;
+ struct dma_object *dma = dev_get_drvdata(&of_dev->dev);
- list_for_each_safe(ptr, n, &dma_list) {
- dma = list_entry(ptr, struct dma_object, list);
- list_del_init(ptr);
-
- snd_soc_unregister_platform(&of_dev->dev);
- iounmap(dma->channel);
- irq_dispose_mapping(dma->irq);
- kfree(dma);
- }
+ snd_soc_unregister_platform(&of_dev->dev);
+ iounmap(dma->channel);
+ irq_dispose_mapping(dma->irq);
+ kfree(dma);
return 0;
}