summaryrefslogtreecommitdiff
path: root/sound/soc/mxs
diff options
context:
space:
mode:
authorJulia Lawall <julia@diku.dk>2011-10-18 17:06:39 +0200
committerMark Brown <broonie@opensource.wolfsonmicro.com>2011-10-22 10:46:35 +0100
commit226d0f22d044f0151287bb7cf334b85182248f0e (patch)
treec85786a71a405d3c1a1c0d96a685d460d9d649d5 /sound/soc/mxs
parent33cb92cff9568dd9feb2825bd3605bf099bc6b63 (diff)
ASoC: keep pointer to resource so it can be freed
Add a new variable for storing resources accessed subsequent to the one accessed using request_mem_region, so the one accessed using request_mem_region can be released if needed. The resource variable names are also changed to be more descriptive. This code is also missing some calls to iounmap. The semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // <smpl> @r@ expression E, E1; identifier f; statement S1,S2,S3; @@ if (E == NULL) { ... when != if (E == NULL || ...) S1 else S2 when != E = E1 *E->f ... when any return ...; } else S3 // </smpl> Signed-off-by: Julia Lawall <julia@diku.dk> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/mxs')
-rw-r--r--sound/soc/mxs/mxs-saif.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/sound/soc/mxs/mxs-saif.c b/sound/soc/mxs/mxs-saif.c
index 401944cf4560..76dc74d24fc2 100644
--- a/sound/soc/mxs/mxs-saif.c
+++ b/sound/soc/mxs/mxs-saif.c
@@ -617,7 +617,7 @@ static irqreturn_t mxs_saif_irq(int irq, void *dev_id)
static int mxs_saif_probe(struct platform_device *pdev)
{
- struct resource *res;
+ struct resource *iores, *dmares;
struct mxs_saif *saif;
struct mxs_saif_platform_data *pdata;
int ret = 0;
@@ -655,35 +655,36 @@ static int mxs_saif_probe(struct platform_device *pdev)
goto failed_clk;
}
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!res) {
+ iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ if (!iores) {
ret = -ENODEV;
dev_err(&pdev->dev, "failed to get io resource: %d\n",
ret);
goto failed_get_resource;
}
- if (!request_mem_region(res->start, resource_size(res), "mxs-saif")) {
+ if (!request_mem_region(iores->start, resource_size(iores),
+ "mxs-saif")) {
dev_err(&pdev->dev, "request_mem_region failed\n");
ret = -EBUSY;
goto failed_get_resource;
}
- saif->base = ioremap(res->start, resource_size(res));
+ saif->base = ioremap(iores->start, resource_size(iores));
if (!saif->base) {
dev_err(&pdev->dev, "ioremap failed\n");
ret = -ENODEV;
goto failed_ioremap;
}
- res = platform_get_resource(pdev, IORESOURCE_DMA, 0);
- if (!res) {
+ dmares = platform_get_resource(pdev, IORESOURCE_DMA, 0);
+ if (!dmares) {
ret = -ENODEV;
dev_err(&pdev->dev, "failed to get dma resource: %d\n",
ret);
goto failed_ioremap;
}
- saif->dma_param.chan_num = res->start;
+ saif->dma_param.chan_num = dmares->start;
saif->irq = platform_get_irq(pdev, 0);
if (saif->irq < 0) {
@@ -742,7 +743,7 @@ failed_get_irq2:
failed_get_irq1:
iounmap(saif->base);
failed_ioremap:
- release_mem_region(res->start, resource_size(res));
+ release_mem_region(iores->start, resource_size(iores));
failed_get_resource:
clk_put(saif->clk);
failed_clk: