* [PATCH] ASoC: zx296702-i2s: Fix resource leak when unload module
@ 2015-08-29 15:09 Axel Lin
2015-08-30 11:26 ` Applied "ASoC: zx296702-i2s: Fix resource leak when unload module" to the asoc tree Mark Brown
2015-08-30 13:35 ` [PATCH] ASoC: zx296702-i2s: Fix resource leak when unload module Jun Nie
0 siblings, 2 replies; 3+ messages in thread
From: Axel Lin @ 2015-08-29 15:09 UTC (permalink / raw)
To: Mark Brown; +Cc: Jun Nie, Liam Girdwood, alsa-devel
Use devm_* API to fix leaks in current code.
1. Use devm_kzalloc to fix memory leak for zx_i2s when unload the module.
2. Use devm_snd_soc_register_component to ensure component is unregistered
when unload the module.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
sound/soc/zte/zx296702-i2s.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/soc/zte/zx296702-i2s.c b/sound/soc/zte/zx296702-i2s.c
index 1930c42..1cad93d 100644
--- a/sound/soc/zte/zx296702-i2s.c
+++ b/sound/soc/zte/zx296702-i2s.c
@@ -380,7 +380,7 @@ static int zx_i2s_probe(struct platform_device *pdev)
struct zx_i2s_info *zx_i2s;
int ret;
- zx_i2s = kzalloc(sizeof(*zx_i2s), GFP_KERNEL);
+ zx_i2s = devm_kzalloc(&pdev->dev, sizeof(*zx_i2s), GFP_KERNEL);
if (!zx_i2s)
return -ENOMEM;
@@ -401,8 +401,8 @@ static int zx_i2s_probe(struct platform_device *pdev)
writel_relaxed(0, zx_i2s->reg_base + ZX_I2S_FIFO_CTRL);
platform_set_drvdata(pdev, zx_i2s);
- ret = snd_soc_register_component(&pdev->dev, &zx_i2s_component,
- &zx_i2s_dai, 1);
+ ret = devm_snd_soc_register_component(&pdev->dev, &zx_i2s_component,
+ &zx_i2s_dai, 1);
if (ret) {
dev_err(&pdev->dev, "Register DAI failed: %d\n", ret);
return ret;
--
2.1.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Applied "ASoC: zx296702-i2s: Fix resource leak when unload module" to the asoc tree
2015-08-29 15:09 [PATCH] ASoC: zx296702-i2s: Fix resource leak when unload module Axel Lin
@ 2015-08-30 11:26 ` Mark Brown
2015-08-30 13:35 ` [PATCH] ASoC: zx296702-i2s: Fix resource leak when unload module Jun Nie
1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2015-08-30 11:26 UTC (permalink / raw)
To: Axel Lin, Mark Brown; +Cc: alsa-devel
The patch
ASoC: zx296702-i2s: Fix resource leak when unload module
has been applied to the asoc tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
>From a695d474ab850cde27e82e4f3f1431269f00762b Mon Sep 17 00:00:00 2001
From: Axel Lin <axel.lin@ingics.com>
Date: Sat, 29 Aug 2015 23:09:30 +0800
Subject: [PATCH] ASoC: zx296702-i2s: Fix resource leak when unload module
Use devm_* API to fix leaks in current code.
1. Use devm_kzalloc to fix memory leak for zx_i2s when unload the module.
2. Use devm_snd_soc_register_component to ensure component is unregistered
when unload the module.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
sound/soc/zte/zx296702-i2s.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/soc/zte/zx296702-i2s.c b/sound/soc/zte/zx296702-i2s.c
index 98d96e1..f4b681d 100644
--- a/sound/soc/zte/zx296702-i2s.c
+++ b/sound/soc/zte/zx296702-i2s.c
@@ -380,7 +380,7 @@ static int zx_i2s_probe(struct platform_device *pdev)
struct zx_i2s_info *zx_i2s;
int ret;
- zx_i2s = kzalloc(sizeof(*zx_i2s), GFP_KERNEL);
+ zx_i2s = devm_kzalloc(&pdev->dev, sizeof(*zx_i2s), GFP_KERNEL);
if (!zx_i2s)
return -ENOMEM;
@@ -401,8 +401,8 @@ static int zx_i2s_probe(struct platform_device *pdev)
writel_relaxed(0, zx_i2s->reg_base + ZX_I2S_FIFO_CTRL);
platform_set_drvdata(pdev, zx_i2s);
- ret = snd_soc_register_component(&pdev->dev, &zx_i2s_component,
- &zx_i2s_dai, 1);
+ ret = devm_snd_soc_register_component(&pdev->dev, &zx_i2s_component,
+ &zx_i2s_dai, 1);
if (ret) {
dev_err(&pdev->dev, "Register DAI failed: %d\n", ret);
return ret;
--
2.5.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] ASoC: zx296702-i2s: Fix resource leak when unload module
2015-08-29 15:09 [PATCH] ASoC: zx296702-i2s: Fix resource leak when unload module Axel Lin
2015-08-30 11:26 ` Applied "ASoC: zx296702-i2s: Fix resource leak when unload module" to the asoc tree Mark Brown
@ 2015-08-30 13:35 ` Jun Nie
1 sibling, 0 replies; 3+ messages in thread
From: Jun Nie @ 2015-08-30 13:35 UTC (permalink / raw)
To: Axel Lin; +Cc: alsa-devel, Mark Brown, Liam Girdwood
Reviewed-by: Jun Nie <jun.nie@linaro.org>
2015-08-29 23:09 GMT+08:00 Axel Lin <axel.lin@ingics.com>:
> Use devm_* API to fix leaks in current code.
> 1. Use devm_kzalloc to fix memory leak for zx_i2s when unload the module.
> 2. Use devm_snd_soc_register_component to ensure component is unregistered
> when unload the module.
>
> Signed-off-by: Axel Lin <axel.lin@ingics.com>
> ---
> sound/soc/zte/zx296702-i2s.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/sound/soc/zte/zx296702-i2s.c b/sound/soc/zte/zx296702-i2s.c
> index 1930c42..1cad93d 100644
> --- a/sound/soc/zte/zx296702-i2s.c
> +++ b/sound/soc/zte/zx296702-i2s.c
> @@ -380,7 +380,7 @@ static int zx_i2s_probe(struct platform_device *pdev)
> struct zx_i2s_info *zx_i2s;
> int ret;
>
> - zx_i2s = kzalloc(sizeof(*zx_i2s), GFP_KERNEL);
> + zx_i2s = devm_kzalloc(&pdev->dev, sizeof(*zx_i2s), GFP_KERNEL);
> if (!zx_i2s)
> return -ENOMEM;
>
> @@ -401,8 +401,8 @@ static int zx_i2s_probe(struct platform_device *pdev)
> writel_relaxed(0, zx_i2s->reg_base + ZX_I2S_FIFO_CTRL);
> platform_set_drvdata(pdev, zx_i2s);
>
> - ret = snd_soc_register_component(&pdev->dev, &zx_i2s_component,
> - &zx_i2s_dai, 1);
> + ret = devm_snd_soc_register_component(&pdev->dev, &zx_i2s_component,
> + &zx_i2s_dai, 1);
> if (ret) {
> dev_err(&pdev->dev, "Register DAI failed: %d\n", ret);
> return ret;
> --
> 2.1.0
>
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-08-30 14:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-29 15:09 [PATCH] ASoC: zx296702-i2s: Fix resource leak when unload module Axel Lin
2015-08-30 11:26 ` Applied "ASoC: zx296702-i2s: Fix resource leak when unload module" to the asoc tree Mark Brown
2015-08-30 13:35 ` [PATCH] ASoC: zx296702-i2s: Fix resource leak when unload module Jun Nie
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.