Skip to content

Commit

Permalink
ASoC: core: tidyup snd_soc_register_codec() fail case
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Kuninori Morimoto authored and Mark Brown committed Mar 4, 2013
1 parent 6dbe51c commit f790b94
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions sound/soc/soc-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
}
}
}
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit f790b94

Please sign in to comment.