All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Amadeusz Sławiński" <amadeuszx.slawinski@linux.intel.com>
To: Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>, Takashi Iwai <tiwai@suse.com>
Cc: alsa-devel@alsa-project.org,
	"Amadeusz Sławiński" <amadeuszx.slawinski@linux.intel.com>,
	"Ranjani Sridharan" <ranjani.sridharan@linux.intel.com>
Subject: [PATCH v2 2/6] ASoC: topology: Check return value of soc_tplg_create_tlv
Date: Fri, 27 Mar 2020 16:47:25 -0400	[thread overview]
Message-ID: <20200327204729.397-3-amadeuszx.slawinski@linux.intel.com> (raw)
In-Reply-To: <20200327204729.397-1-amadeuszx.slawinski@linux.intel.com>

Function soc_tplg_create_tlv can fail, so we should check if it succeded
or not and proceed appropriately.

Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
---

 v2:
  Added this patch

 sound/soc/soc-topology.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c
index 434e152ac8ee..c3811dd66b68 100644
--- a/sound/soc/soc-topology.c
+++ b/sound/soc/soc-topology.c
@@ -894,7 +894,13 @@ static int soc_tplg_dmixer_create(struct soc_tplg *tplg, unsigned int count,
 		}
 
 		/* create any TLV data */
-		soc_tplg_create_tlv(tplg, &kc, &mc->hdr);
+		err = soc_tplg_create_tlv(tplg, &kc, &mc->hdr);
+		if (err < 0) {
+			dev_err(tplg->dev, "ASoC: failed to create TLV %s\n",
+				mc->hdr.name);
+			kfree(sm);
+			continue;
+		}
 
 		/* pass control to driver for optional further init */
 		err = soc_tplg_init_kcontrol(tplg, &kc,
@@ -1355,7 +1361,13 @@ static struct snd_kcontrol_new *soc_tplg_dapm_widget_dmixer_create(
 		}
 
 		/* create any TLV data */
-		soc_tplg_create_tlv(tplg, &kc[i], &mc->hdr);
+		err = soc_tplg_create_tlv(tplg, &kc[i], &mc->hdr);
+		if (err < 0) {
+			dev_err(tplg->dev, "ASoC: failed to create TLV %s\n",
+				mc->hdr.name);
+			kfree(sm);
+			continue;
+		}
 
 		/* pass control to driver for optional further init */
 		err = soc_tplg_init_kcontrol(tplg, &kc[i],
-- 
2.17.1


  parent reply	other threads:[~2020-03-27 18:40 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-27 20:47 [PATCH v2 0/6] ASoC: topology: Propagate error appropriately Amadeusz Sławiński
2020-03-27 20:47 ` [PATCH v2 1/6] ASoC: topology: Add missing memory checks Amadeusz Sławiński
2020-04-09 12:02   ` Applied "ASoC: topology: Add missing memory checks" to the asoc tree Mark Brown
2020-03-27 20:47 ` Amadeusz Sławiński [this message]
2020-04-09 12:02   ` Applied "ASoC: topology: Check return value of soc_tplg_create_tlv" " Mark Brown
2020-03-27 20:47 ` [PATCH v2 3/6] ASoC: topology: Check return value of soc_tplg_*_create Amadeusz Sławiński
2020-03-27 18:56   ` Pierre-Louis Bossart
2020-03-30  8:12     ` Amadeusz Sławiński
2020-03-30 15:51       ` Pierre-Louis Bossart
2020-03-30 16:10         ` Amadeusz Sławiński
2020-03-30 16:36           ` Pierre-Louis Bossart
2020-04-09 12:02   ` Applied "ASoC: topology: Check return value of soc_tplg_*_create" to the asoc tree Mark Brown
2020-03-27 20:47 ` [PATCH v2 4/6] ASoC: topology: Check soc_tplg_add_route return value Amadeusz Sławiński
2020-04-09 12:02   ` Applied "ASoC: topology: Check soc_tplg_add_route return value" to the asoc tree Mark Brown
2020-03-27 20:47 ` [PATCH v2 5/6] ASoC: topology: Check return value of pcm_new_ver Amadeusz Sławiński
2020-04-09 12:02   ` Applied "ASoC: topology: Check return value of pcm_new_ver" to the asoc tree Mark Brown
2020-03-27 20:47 ` [PATCH v2 6/6] ASoC: topology: Check return value of soc_tplg_dai_config Amadeusz Sławiński
2020-04-09 12:02   ` Applied "ASoC: topology: Check return value of soc_tplg_dai_config" to the asoc tree Mark Brown
2020-03-30 16:38 ` [PATCH v2 0/6] ASoC: topology: Propagate error appropriately Pierre-Louis Bossart
2020-04-08  8:51   ` Amadeusz Sławiński
2020-04-08 14:20     ` Pierre-Louis Bossart
2020-04-08 14:46       ` Amadeusz Sławiński
2020-04-08 16:52         ` Ranjani Sridharan
2020-03-30 16:41 ` Sridharan, Ranjani

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=20200327204729.397-3-amadeuszx.slawinski@linux.intel.com \
    --to=amadeuszx.slawinski@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=ranjani.sridharan@linux.intel.com \
    --cc=tiwai@suse.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 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.