[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <65EE16ACC360FA4D99C96DC085B3F7722AB64D@039-SN1MPN1-003.039d.mgd.msft.net>
Date: Tue, 18 Oct 2011 13:01:05 +0000
From: Dong Aisheng-B29396 <B29396@...escale.com>
To: Julia Lawall <julia@...u.dk>, Liam Girdwood <lrg@...com>
CC: "kernel-janitors@...r.kernel.org" <kernel-janitors@...r.kernel.org>,
Mark Brown <broonie@...nsource.wolfsonmicro.com>,
Jaroslav Kysela <perex@...ex.cz>, Takashi Iwai <tiwai@...e.de>,
Wolfram Sang <w.sang@...gutronix.de>,
"alsa-devel@...a-project.org" <alsa-devel@...a-project.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH 1/3] sound/soc/mxs/mxs-saif.c: keep pointer to resource
so it can be freed
> -----Original Message-----
> From: Julia Lawall [mailto:julia@...u.dk]
> Sent: Tuesday, October 18, 2011 11:46 AM
> To: Liam Girdwood
> Cc: kernel-janitors@...r.kernel.org; Mark Brown; Jaroslav Kysela; Takashi
> Iwai; Dong Aisheng-B29396; Wolfram Sang; alsa-devel@...a-project.org;
> linux-kernel@...r.kernel.org
> Subject: [PATCH 1/3] sound/soc/mxs/mxs-saif.c: keep pointer to resource
> so it can be freed
>
> From: Julia Lawall <julia@...u.dk>
>
> 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 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@...u.dk>
>
> ---
> sound/soc/mxs/mxs-saif.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/sound/soc/mxs/mxs-saif.c b/sound/soc/mxs/mxs-saif.c index
> 401944c..e12ff78 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 *res, *res1;
How about naming iores and dmares?
> struct mxs_saif *saif;
> struct mxs_saif_platform_data *pdata;
> int ret = 0;
> @@ -676,14 +676,14 @@ static int mxs_saif_probe(struct platform_device
> *pdev)
> goto failed_ioremap;
> }
>
> - res = platform_get_resource(pdev, IORESOURCE_DMA, 0);
> - if (!res) {
> + res1 = platform_get_resource(pdev, IORESOURCE_DMA, 0);
> + if (!res1) {
> 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 = res1->start;
>
> saif->irq = platform_get_irq(pdev, 0);
> if (saif->irq < 0) {
>
Regards
Dong Aisheng
--
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