Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C3915C433F5 for ; Mon, 4 Oct 2021 21:30:06 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 637E761528 for ; Mon, 4 Oct 2021 21:30:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 637E761528 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id B06981677; Mon, 4 Oct 2021 23:29:13 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz B06981677 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1633383003; bh=n9hj9p/AaJXN9SKJBQMETNMVWmyqxkK2++xqSYBnyF0=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=L2j5KJgtY21pRslCSIcoyIVj0DsGMNQdImIPcAK9Sd4NxZhyvVFstf1sFgDQDZcUv B7GaUuUoWzrGv2XB2YT25RcSKQ8ppvoyTPKO3VAl6iODzrvJGoYCB4hIt3atOvTL74 bG7FvRG7powtaqJuLrfYqH8i2yZtfgPzpVhlK9x0= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 39B0FF804ED; Mon, 4 Oct 2021 23:27:57 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 68A86F804F1; Mon, 4 Oct 2021 23:27:56 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id B29B5F80249 for ; Mon, 4 Oct 2021 23:27:46 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz B29B5F80249 X-IronPort-AV: E=McAfee;i="6200,9189,10127"; a="206410599" X-IronPort-AV: E=Sophos;i="5.85,346,1624345200"; d="scan'208";a="206410599" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Oct 2021 14:27:40 -0700 X-IronPort-AV: E=Sophos;i="5.85,346,1624345200"; d="scan'208";a="521586237" Received: from ksgonzal-mobl.amr.corp.intel.com (HELO pbossart-mobl3.intel.com) ([10.209.181.38]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Oct 2021 14:27:39 -0700 From: Pierre-Louis Bossart To: alsa-devel@alsa-project.org Subject: [PATCH 3/3] ASoC: SOF: topology: return error if sof_connect_dai_widget() fails Date: Mon, 4 Oct 2021 16:27:29 -0500 Message-Id: <20211004212729.199550-4-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211004212729.199550-1-pierre-louis.bossart@linux.intel.com> References: <20211004212729.199550-1-pierre-louis.bossart@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Cc: tiwai@suse.de, Guennadi Liakhovetski , broonie@kernel.org, Ranjani Sridharan , Pierre-Louis Bossart X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: Ranjani Sridharan Return the error if sof_connect_dai_widget() fails to abort topology loading and prevent card registration. Reviewed-by: Guennadi Liakhovetski Signed-off-by: Ranjani Sridharan Signed-off-by: Pierre-Louis Bossart --- sound/soc/sof/topology.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c index cc6a96b552d3..e81fa2058c7d 100644 --- a/sound/soc/sof/topology.c +++ b/sound/soc/sof/topology.c @@ -2379,13 +2379,14 @@ static int sof_widget_ready(struct snd_soc_component *scomp, int index, } ret = sof_widget_load_dai(scomp, index, swidget, tw, dai); - if (ret == 0) { - sof_connect_dai_widget(scomp, w, tw, dai); - list_add(&dai->list, &sdev->dai_list); - swidget->private = dai; - } else { + if (!ret) + ret = sof_connect_dai_widget(scomp, w, tw, dai); + if (ret < 0) { kfree(dai); + break; } + list_add(&dai->list, &sdev->dai_list); + swidget->private = dai; break; case snd_soc_dapm_mixer: ret = sof_widget_load_mixer(scomp, index, swidget, tw); -- 2.25.1