All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: topology: free created components in tplg load error
@ 2019-02-17 13:23 Bard liao
  2019-02-18 18:49 ` Applied "ASoC: topology: free created components in tplg load error" to the asoc tree Mark Brown
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Bard liao @ 2019-02-17 13:23 UTC (permalink / raw)
  To: broonie
  Cc: tiwai, liam.r.girdwood, alsa-devel, pierre-louis.bossart, bard.liao

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

Signed-off-by: Bard liao <yung-chuan.liao@linux.intel.com>
---
 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 c5638e15a2dd..25fca7055464 100644
--- a/sound/soc/soc-topology.c
+++ b/sound/soc/soc-topology.c
@@ -2587,6 +2587,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));
@@ -2600,7 +2601,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.17.1

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

* Applied "ASoC: topology: free created components in tplg load error" to the asoc tree
  2019-02-17 13:23 [PATCH] ASoC: topology: free created components in tplg load error Bard liao
@ 2019-02-18 18:49 ` Mark Brown
  2019-02-18 18:52 ` Mark Brown
  2019-02-19 15:28 ` [PATCH] ASoC: topology: free created components in tplg load error Pierre-Louis Bossart
  2 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2019-02-18 18:49 UTC (permalink / raw)
  To: Bard liao
  Cc: alsa-devel, tiwai, pierre-louis.bossart, liam.r.girdwood,
	broonie, bard.liao

The patch

   ASoC: topology: free created components in tplg load error

has been applied to the asoc tree at

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 304017d31df36fb61eb2ed3ebf65fb6870b3c731 Mon Sep 17 00:00:00 2001
From: Bard liao <yung-chuan.liao@linux.intel.com>
Date: Sun, 17 Feb 2019 21:23:47 +0800
Subject: [PATCH] ASoC: topology: free created components in tplg load error

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>
---
 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 fc79ec6927e3..731b963b6995 100644
--- a/sound/soc/soc-topology.c
+++ b/sound/soc/soc-topology.c
@@ -2487,6 +2487,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));
@@ -2500,7 +2501,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.20.1

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

* Applied "ASoC: topology: free created components in tplg load error" to the asoc tree
  2019-02-17 13:23 [PATCH] ASoC: topology: free created components in tplg load error Bard liao
  2019-02-18 18:49 ` Applied "ASoC: topology: free created components in tplg load error" to the asoc tree Mark Brown
@ 2019-02-18 18:52 ` Mark Brown
  2019-02-19 15:28 ` [PATCH] ASoC: topology: free created components in tplg load error Pierre-Louis Bossart
  2 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2019-02-18 18:52 UTC (permalink / raw)
  To: Bard liao
  Cc: alsa-devel, tiwai, pierre-louis.bossart, liam.r.girdwood,
	broonie, bard.liao

The patch

   ASoC: topology: free created components in tplg load error

has been applied to the asoc tree at

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 304017d31df36fb61eb2ed3ebf65fb6870b3c731 Mon Sep 17 00:00:00 2001
From: Bard liao <yung-chuan.liao@linux.intel.com>
Date: Sun, 17 Feb 2019 21:23:47 +0800
Subject: [PATCH] ASoC: topology: free created components in tplg load error

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>
---
 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 fc79ec6927e3..731b963b6995 100644
--- a/sound/soc/soc-topology.c
+++ b/sound/soc/soc-topology.c
@@ -2487,6 +2487,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));
@@ -2500,7 +2501,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.20.1

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

* Re: [PATCH] ASoC: topology: free created components in tplg load error
  2019-02-17 13:23 [PATCH] ASoC: topology: free created components in tplg load error Bard liao
  2019-02-18 18:49 ` Applied "ASoC: topology: free created components in tplg load error" to the asoc tree Mark Brown
  2019-02-18 18:52 ` Mark Brown
@ 2019-02-19 15:28 ` Pierre-Louis Bossart
  2 siblings, 0 replies; 4+ messages in thread
From: Pierre-Louis Bossart @ 2019-02-19 15:28 UTC (permalink / raw)
  To: Bard liao, broonie; +Cc: tiwai, liam.r.girdwood, alsa-devel, bard.liao


On 2/17/19 7:23 AM, Bard liao wrote:
> Topology resources are no longer needed if any element failed to load.
>
> Signed-off-by: Bard liao <yung-chuan.liao@linux.intel.com>

Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>


> ---
>   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 c5638e15a2dd..25fca7055464 100644
> --- a/sound/soc/soc-topology.c
> +++ b/sound/soc/soc-topology.c
> @@ -2587,6 +2587,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));
> @@ -2600,7 +2601,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);
>   

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

end of thread, other threads:[~2019-02-19 15:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-17 13:23 [PATCH] ASoC: topology: free created components in tplg load error Bard liao
2019-02-18 18:49 ` Applied "ASoC: topology: free created components in tplg load error" to the asoc tree Mark Brown
2019-02-18 18:52 ` Mark Brown
2019-02-19 15:28 ` [PATCH] ASoC: topology: free created components in tplg load error Pierre-Louis Bossart

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.