diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2013-02-25 00:40:09 -0800 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2013-03-04 11:07:43 +0800 |
commit | f790b94d7867fb0555f91ae920b9001b42ae38a6 (patch) | |
tree | 2729c469a3c6c6dad68d87808e231179ee8096b8 | |
parent | 6dbe51c251a327e012439c4772097a13df43c5b8 (diff) | |
download | linux-3.10-f790b94d7867fb0555f91ae920b9001b42ae38a6.tar.gz linux-3.10-f790b94d7867fb0555f91ae920b9001b42ae38a6.tar.bz2 linux-3.10-f790b94d7867fb0555f91ae920b9001b42ae38a6.zip |
ASoC: core: tidyup snd_soc_register_codec() fail case
kfree() on snd_soc_register_codec() was summarized to one place.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
-rw-r--r-- | sound/soc/soc-core.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index b7e84a7cd9e..a872be1ee44 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -4022,8 +4022,8 @@ int snd_soc_register_codec(struct device *dev, /* create CODEC component name */ codec->name = fmt_single_name(dev, &codec->id); if (codec->name == NULL) { - kfree(codec); - return -ENOMEM; + ret = -ENOMEM; + goto fail_codec; } if (codec_drv->compress_type) @@ -4062,7 +4062,7 @@ int snd_soc_register_codec(struct device *dev, reg_size, GFP_KERNEL); if (!codec->reg_def_copy) { ret = -ENOMEM; - goto fail; + goto fail_codec_name; } } } @@ -4096,8 +4096,9 @@ int snd_soc_register_codec(struct device *dev, dev_dbg(codec->dev, "ASoC: Registered codec '%s'\n", codec->name); return 0; -fail: +fail_codec_name: kfree(codec->name); +fail_codec: kfree(codec); return ret; } |