Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1609332 > unrolled thread
| Started by | Leo Yan <leo.yan@linaro.org> |
|---|---|
| First post | 2017-03-26 16:50 +0200 |
| Last post | 2017-03-26 17:00 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH 5/5] ALSA: AACI: Convert to use devm_ioremap_resource() Leo Yan <leo.yan@linaro.org> - 2017-03-26 16:50 +0200
Re: [PATCH 5/5] ALSA: AACI: Convert to use devm_ioremap_resource() Russell King - ARM Linux <linux@armlinux.org.uk> - 2017-03-26 17:00 +0200
| From | Leo Yan <leo.yan@linaro.org> |
|---|---|
| Date | 2017-03-26 16:50 +0200 |
| Subject | [PATCH 5/5] ALSA: AACI: Convert to use devm_ioremap_resource() |
| Message-ID | <tphEt-1ge-7@gated-at.bofh.it> |
Convert to use devm_ioremap_resource() in probe function, otherwise it's
missed to unremap this region if probe failed or rmmod module.
Signed-off-by: Leo Yan <leo.yan@linaro.org>
---
sound/arm/aaci.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/sound/arm/aaci.c b/sound/arm/aaci.c
index 4140b1b..2078568 100644
--- a/sound/arm/aaci.c
+++ b/sound/arm/aaci.c
@@ -990,19 +990,13 @@ static int aaci_probe(struct amba_device *dev,
struct aaci *aaci;
int ret, i;
- ret = amba_request_regions(dev, NULL);
- if (ret)
- return ret;
-
aaci = aaci_init_card(dev);
- if (!aaci) {
- ret = -ENOMEM;
- goto out;
- }
+ if (!aaci)
+ return -ENOMEM;
- aaci->base = ioremap(dev->res.start, resource_size(&dev->res));
- if (!aaci->base) {
- ret = -ENOMEM;
+ aaci->base = devm_ioremap_resource(&dev->dev, &dev->res);
+ if (IS_ERR(aaci->base)) {
+ ret = PTR_ERR(aaci->base);
goto out;
}
@@ -1064,9 +1058,7 @@ static int aaci_probe(struct amba_device *dev,
}
out:
- if (aaci)
- snd_card_free(aaci->card);
- amba_release_regions(dev);
+ snd_card_free(aaci->card);
return ret;
}
@@ -1079,7 +1071,6 @@ static int aaci_remove(struct amba_device *dev)
writel(0, aaci->base + AACI_MAINCR);
snd_card_free(card);
- amba_release_regions(dev);
}
return 0;
--
2.7.4
[toc] | [next] | [standalone]
| From | Russell King - ARM Linux <linux@armlinux.org.uk> |
|---|---|
| Date | 2017-03-26 17:00 +0200 |
| Message-ID | <tphOa-1js-11@gated-at.bofh.it> |
| In reply to | #1609332 |
On Sun, Mar 26, 2017 at 10:41:54PM +0800, Leo Yan wrote:
> Convert to use devm_ioremap_resource() in probe function, otherwise it's
> missed to unremap this region if probe failed or rmmod module.
Again, wrong - just because there's nothing in the cleanup paths does
not mean it doesn't clean up.
static void aaci_free_card(struct snd_card *card)
{
struct aaci *aaci = card->private_data;
iounmap(aaci->base);
}
This unmaps the mapping you claim it fails to do so. So, your patch
actually _creates_ bugs that were not there before.
NAK.
--
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web