All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: snd-core: tidyup snd_soc_register_codec() fail case
@ 2013-02-25  8:40 Kuninori Morimoto
  2013-03-01 10:59 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Kuninori Morimoto @ 2013-02-25  8:40 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Simon, Liam Girdwood, Kuninori Morimoto

kfree() on snd_soc_register_codec() was summarized to one place.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/soc-core.c |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 689eb04..ceac893 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -3983,8 +3983,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)
@@ -4023,7 +4023,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;
 			}
 		}
 	}
@@ -4057,8 +4057,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;
 }
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ASoC: snd-core: tidyup snd_soc_register_codec() fail case
  2013-02-25  8:40 [PATCH] ASoC: snd-core: tidyup snd_soc_register_codec() fail case Kuninori Morimoto
@ 2013-03-01 10:59 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2013-03-01 10:59 UTC (permalink / raw)
  To: Kuninori Morimoto; +Cc: Linux-ALSA, Simon, Liam Girdwood, Kuninori Morimoto


[-- Attachment #1.1: Type: text/plain, Size: 152 bytes --]

On Mon, Feb 25, 2013 at 12:40:09AM -0800, Kuninori Morimoto wrote:
> kfree() on snd_soc_register_codec() was summarized to one place.

Applied, thanks.

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-03-01 10:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-25  8:40 [PATCH] ASoC: snd-core: tidyup snd_soc_register_codec() fail case Kuninori Morimoto
2013-03-01 10:59 ` Mark Brown

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.