[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1313820761-12042-3-git-send-email-julia@diku.dk>
Date: Sat, 20 Aug 2011 08:12:40 +0200
From: Julia Lawall <julia@...u.dk>
To: Liam Girdwood <lrg@...com>
Cc: kernel-janitors@...r.kernel.org,
Mark Brown <broonie@...nsource.wolfsonmicro.com>,
Jaroslav Kysela <perex@...ex.cz>, Takashi Iwai <tiwai@...e.de>,
Dong Aisheng <b29396@...escale.com>,
alsa-devel@...a-project.org, linux-kernel@...r.kernel.org
Subject: [PATCH 3/4] sound/soc/mxs/mxs-saif.c: add missing kfree
From: Julia Lawall <julia@...u.dk>
The error handling code prior to get_clk also needs to call kfree. The
label name is changed to reflect its more general use.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// <smpl>
@@
identifier x;
expression E1!=0,E2,E3,E4;
statement S;
iterator I;
@@
(
if (...) { ... when != kfree(x)
when != x = E3
when != E3 = x
* return ...;
}
... when != x = E2
when != I(...,x,...) S
if (...) { ... when != x = E4
kfree(x); ... return ...; }
)
// </smpl>
Signed-off-by: Julia Lawall <julia@...u.dk>
---
sound/soc/mxs/mxs-saif.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/sound/soc/mxs/mxs-saif.c b/sound/soc/mxs/mxs-saif.c
index 0b3adae..4a17bc8 100644
--- a/sound/soc/mxs/mxs-saif.c
+++ b/sound/soc/mxs/mxs-saif.c
@@ -523,8 +523,10 @@ static int mxs_saif_probe(struct platform_device *pdev)
if (!saif)
return -ENOMEM;
- if (pdev->id >= ARRAY_SIZE(mxs_saif))
- return -EINVAL;
+ if (pdev->id >= ARRAY_SIZE(mxs_saif)) {
+ ret = -EINVAL;
+ goto failed;
+ }
mxs_saif[pdev->id] = saif;
saif->clk = clk_get(&pdev->dev, NULL);
@@ -532,7 +534,7 @@ static int mxs_saif_probe(struct platform_device *pdev)
ret = PTR_ERR(saif->clk);
dev_err(&pdev->dev, "Cannot get the clock: %d\n",
ret);
- goto failed_clk;
+ goto failed;
}
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -625,7 +627,7 @@ failed_ioremap:
release_mem_region(res->start, resource_size(res));
failed_get_resource:
clk_put(saif->clk);
-failed_clk:
+failed:
kfree(saif);
return ret;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists