From: Julia Lawall <julia@diku.dk>
To: Manuel Lauss <manuel.lauss@googlemail.com>
Cc: Liam Girdwood <lrg@ti.com>,
kernel-janitors@vger.kernel.org,
Mark Brown <broonie@opensource.wolfsonmicro.com>,
Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.de>,
Axel Lin <axel.lin@gmail.com>,
alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] sound/soc/au1x: keep pointer to resource so it can be freed
Date: Wed, 19 Oct 2011 17:09:30 +0200 (CEST) [thread overview]
Message-ID: <Pine.LNX.4.64.1110191709010.31584@ask.diku.dk> (raw)
In-Reply-To: <CAOLZvyFoiuHEfpnozWpAM5h92rjay-asqXX0tY1P1ZzO8eTGOQ@mail.gmail.com>
On Wed, 19 Oct 2011, Manuel Lauss wrote:
> On Tue, Oct 18, 2011 at 5:45 AM, Julia Lawall <julia@diku.dk> wrote:
> > From: Julia Lawall <julia@diku.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.
> >
> > This code is also missing some calls to iounmap.
>
> How about something much simpler, like this:
If you like, I guess. But I don't think I have seen that done before...
julia
> From 940e38b3f0beff6fcd8f62f627dce622e9ca0e54 Mon Sep 17 00:00:00 2001
> From: Manuel Lauss <manuel.lauss@googlemail.com>
> Date: Wed, 19 Oct 2011 16:45:12 +0200
> Subject: [PATCH] ASoC: au1x: fix error paths in ac97c/i2cs probe callbacks.
>
> add iounmap() and release the correct mem resource.
>
> Signed-off-by: Manuel Lauss <manuel.lauss@googlemail.com>
> ---
> sound/soc/au1x/ac97c.c | 7 +++++--
> sound/soc/au1x/i2sc.c | 7 +++++--
> 2 files changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/sound/soc/au1x/ac97c.c b/sound/soc/au1x/ac97c.c
> index 13802ff..4ec39aa 100644
> --- a/sound/soc/au1x/ac97c.c
> +++ b/sound/soc/au1x/ac97c.c
> @@ -251,12 +251,12 @@ static int __devinit au1xac97c_drvprobe(struct
> platform_device *pdev)
>
> r = platform_get_resource(pdev, IORESOURCE_DMA, 0);
> if (!r)
> - goto out1;
> + goto out2;
> ctx->dmaids[SNDRV_PCM_STREAM_PLAYBACK] = r->start;
>
> r = platform_get_resource(pdev, IORESOURCE_DMA, 1);
> if (!r)
> - goto out1;
> + goto out2;
> ctx->dmaids[SNDRV_PCM_STREAM_CAPTURE] = r->start;
>
> /* switch it on */
> @@ -275,7 +275,10 @@ static int __devinit au1xac97c_drvprobe(struct
> platform_device *pdev)
> ac97c_workdata = ctx;
> return 0;
>
> +out2:
> + iounmap(ctx->mmio);
> out1:
> + r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> release_mem_region(r->start, resource_size(r));
> out0:
> kfree(ctx);
> diff --git a/sound/soc/au1x/i2sc.c b/sound/soc/au1x/i2sc.c
> index 19e0d2a..59fb31a 100644
> --- a/sound/soc/au1x/i2sc.c
> +++ b/sound/soc/au1x/i2sc.c
> @@ -251,12 +251,12 @@ static int __devinit au1xi2s_drvprobe(struct
> platform_device *pdev)
>
> r = platform_get_resource(pdev, IORESOURCE_DMA, 0);
> if (!r)
> - goto out1;
> + goto out2;
> ctx->dmaids[SNDRV_PCM_STREAM_PLAYBACK] = r->start;
>
> r = platform_get_resource(pdev, IORESOURCE_DMA, 1);
> if (!r)
> - goto out1;
> + goto out2;
> ctx->dmaids[SNDRV_PCM_STREAM_CAPTURE] = r->start;
>
> platform_set_drvdata(pdev, ctx);
> @@ -267,7 +267,10 @@ static int __devinit au1xi2s_drvprobe(struct
> platform_device *pdev)
>
> return 0;
>
> +out2:
> + iounmap(ctx->mmio);
> out1:
> + r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> release_mem_region(r->start, resource_size(r));
> out0:
> kfree(ctx);
> --
> 1.7.7
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
next prev parent reply other threads:[~2011-10-19 15:09 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-18 3:45 Julia Lawall
2011-10-19 14:50 ` Manuel Lauss
2011-10-19 15:09 ` Julia Lawall [this message]
2011-10-19 16:47 ` Girdwood, Liam
2011-10-19 16:48 ` Mark Brown
2011-10-19 17:32 ` Julia Lawall
2011-10-19 17:34 ` Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.64.1110191709010.31584@ask.diku.dk \
--to=julia@diku.dk \
--cc=alsa-devel@alsa-project.org \
--cc=axel.lin@gmail.com \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lrg@ti.com \
--cc=manuel.lauss@googlemail.com \
--cc=perex@perex.cz \
--cc=tiwai@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®