diff options
author | Axel Lin <axel.lin@ingics.com> | 2015-08-29 23:09:30 +0800 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2015-08-30 15:47:54 +0100 |
commit | 534dcd7ea60cebc41816eff0c290700acb2cc43e (patch) | |
tree | 840e2f87ac1b876a4b21652b51d2c5cef1e9ff35 /sound/soc/zte | |
parent | bc0195aad0daa2ad5b0d76cce22b167bc3435590 (diff) |
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>
Reviewed-by: Jun Nie <jun.nie@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/zte')
-rw-r--r-- | sound/soc/zte/zx296702-i2s.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sound/soc/zte/zx296702-i2s.c b/sound/soc/zte/zx296702-i2s.c index 98d96e1b17e0..f4b681d7769a 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; |