From: Kuninori Morimoto Subject: [RFC][PATCH] ASoC: remove codec from list if registration failed Date: Thu, 07 Mar 2013 17:42:33 -0800 (PST) Message-ID: <87hakmacqi.wl%kuninori.morimoto.gx@renesas.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail-da0-f42.google.com (mail-da0-f42.google.com [209.85.210.42]) by alsa0.perex.cz (Postfix) with ESMTP id 95508265DD2 for ; Fri, 8 Mar 2013 02:42:36 +0100 (CET) Received: by mail-da0-f42.google.com with SMTP id n15so126650dad.15 for ; Thu, 07 Mar 2013 17:42:35 -0800 (PST) List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: Mark Brown Cc: Linux-ALSA , Simon , Liam Girdwood , Kuninori Morimoto List-Id: alsa-devel@alsa-project.org Current snd_soc_register_codec() adds codec to list, and calls snd_soc_register_dais(). But, this listed codec should be removed if dais registration was failed. Signed-off-by: Kuninori Morimoto --- If my understanding is correct... sound/soc/soc-core.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 1ac96df..38d6182 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -4097,6 +4097,10 @@ int snd_soc_register_codec(struct device *dev, return 0; fail_codec_name: + mutex_lock(&client_mutex); + list_del(&codec->list); + mutex_unlock(&client_mutex); + kfree(codec->name); fail_codec: kfree(codec); -- 1.7.9.5