linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Bard liao <yung-chuan.liao@linux.intel.com>,
	Mark Brown <broonie@kernel.org>, Sasha Levin <sashal@kernel.org>
Subject: [PATCH AUTOSEL 4.4 08/15] ASoC: topology: free created components in tplg load error
Date: Wed, 13 Mar 2019 15:17:54 -0400	[thread overview]
Message-ID: <20190313191806.160547-8-sashal@kernel.org> (raw)
In-Reply-To: <20190313191806.160547-1-sashal@kernel.org>

From: Bard liao <yung-chuan.liao@linux.intel.com>

[ Upstream commit 304017d31df36fb61eb2ed3ebf65fb6870b3c731 ]

Topology resources are no longer needed if any element failed to load.

Signed-off-by: Bard liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 sound/soc/soc-topology.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c
index c1e76feb3529..824f4d7fc41f 100644
--- a/sound/soc/soc-topology.c
+++ b/sound/soc/soc-topology.c
@@ -1770,6 +1770,7 @@ int snd_soc_tplg_component_load(struct snd_soc_component *comp,
 	struct snd_soc_tplg_ops *ops, const struct firmware *fw, u32 id)
 {
 	struct soc_tplg tplg;
+	int ret;
 
 	/* setup parsing context */
 	memset(&tplg, 0, sizeof(tplg));
@@ -1783,7 +1784,12 @@ int snd_soc_tplg_component_load(struct snd_soc_component *comp,
 	tplg.bytes_ext_ops = ops->bytes_ext_ops;
 	tplg.bytes_ext_ops_count = ops->bytes_ext_ops_count;
 
-	return soc_tplg_load(&tplg);
+	ret = soc_tplg_load(&tplg);
+	/* free the created components if fail to load topology */
+	if (ret)
+		snd_soc_tplg_component_remove(comp, SND_SOC_TPLG_INDEX_ALL);
+
+	return ret;
 }
 EXPORT_SYMBOL_GPL(snd_soc_tplg_component_load);
 
-- 
2.19.1


  parent reply	other threads:[~2019-03-13 19:21 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-13 19:17 [PATCH AUTOSEL 4.4 01/15] ARM: 8824/1: fix a migrating irq bug when hotplug cpu Sasha Levin
2019-03-13 19:17 ` [PATCH AUTOSEL 4.4 02/15] assoc_array: Fix shortcut creation Sasha Levin
2019-03-13 19:17 ` [PATCH AUTOSEL 4.4 03/15] scsi: libiscsi: Fix race between iscsi_xmit_task and iscsi_complete_task Sasha Levin
2019-03-13 19:17 ` [PATCH AUTOSEL 4.4 04/15] scsi: libsas: Fix rphy phy_identifier for PHYs with end devices attached Sasha Levin
2019-03-13 19:17 ` [PATCH AUTOSEL 4.4 05/15] net: systemport: Fix reception of BPDUs Sasha Levin
2019-03-13 19:17 ` [PATCH AUTOSEL 4.4 06/15] pinctrl: meson: meson8b: fix the sdxc_a data 1..3 pins Sasha Levin
2019-03-13 19:17 ` [PATCH AUTOSEL 4.4 07/15] net: mv643xx_eth: disable clk on error path in mv643xx_eth_shared_probe() Sasha Levin
2019-03-13 19:17 ` Sasha Levin [this message]
2019-03-13 19:17 ` [PATCH AUTOSEL 4.4 09/15] arm64: Relax GIC version check during early boot Sasha Levin
2019-03-13 19:17 ` [PATCH AUTOSEL 4.4 10/15] tmpfs: fix link accounting when a tmpfile is linked in Sasha Levin
2019-03-13 19:17 ` [PATCH AUTOSEL 4.4 11/15] ARC: uacces: remove lp_start, lp_end from clobber list Sasha Levin
2019-03-13 19:17 ` [PATCH AUTOSEL 4.4 12/15] phonet: fix building with clang Sasha Levin
2019-03-13 19:17 ` [PATCH AUTOSEL 4.4 13/15] mac80211_hwsim: propagate genlmsg_reply return code Sasha Levin
2019-03-13 19:18 ` [PATCH AUTOSEL 4.4 14/15] mdio_bus: Fix use-after-free on device_register fails Sasha Levin
2019-03-13 19:18 ` [PATCH AUTOSEL 4.4 15/15] net: set static variable an initial value in atl2_probe() Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190313191806.160547-8-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=broonie@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=yung-chuan.liao@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).