alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: "Amadeusz Sławiński" <amadeuszx.slawinski@linux.intel.com>,
	"Liam Girdwood" <lgirdwood@gmail.com>,
	"Mark Brown" <broonie@kernel.org>,
	"Takashi Iwai" <tiwai@suse.com>
Cc: alsa-devel@alsa-project.org,
	Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Subject: Re: [PATCH v2 3/6] ASoC: topology: Check return value of soc_tplg_*_create
Date: Mon, 30 Mar 2020 10:51:54 -0500	[thread overview]
Message-ID: <8e03a294-3562-7e26-6654-a5b0f7970060@linux.intel.com> (raw)
In-Reply-To: <41ce872f-7fa5-74cd-396b-9bfae989e91c@linux.intel.com>


>>>       if (tplg->pass != SOC_TPLG_PASS_MIXER) {
>>> @@ -1152,25 +1153,30 @@ static int 
>>> soc_tplg_kcontrol_elems_load(struct soc_tplg *tplg,
>>>           case SND_SOC_TPLG_CTL_RANGE:
>>>           case SND_SOC_TPLG_DAPM_CTL_VOLSW:
>>>           case SND_SOC_TPLG_DAPM_CTL_PIN:
>>> -            soc_tplg_dmixer_create(tplg, 1,
>>> -                           le32_to_cpu(hdr->payload_size));
>>> +            ret = soc_tplg_dmixer_create(tplg, 1,
>>> +                    le32_to_cpu(hdr->payload_size));
>>>               break;
>>>           case SND_SOC_TPLG_CTL_ENUM:
>>>           case SND_SOC_TPLG_CTL_ENUM_VALUE:
>>>           case SND_SOC_TPLG_DAPM_CTL_ENUM_DOUBLE:
>>>           case SND_SOC_TPLG_DAPM_CTL_ENUM_VIRT:
>>>           case SND_SOC_TPLG_DAPM_CTL_ENUM_VALUE:
>>> -            soc_tplg_denum_create(tplg, 1,
>>> -                          le32_to_cpu(hdr->payload_size));
>>> +            ret = soc_tplg_denum_create(tplg, 1,
>>> +                    le32_to_cpu(hdr->payload_size));
>>>               break;
>>>           case SND_SOC_TPLG_CTL_BYTES:
>>> -            soc_tplg_dbytes_create(tplg, 1,
>>> -                           le32_to_cpu(hdr->payload_size));
>>> +            ret = soc_tplg_dbytes_create(tplg, 1,
>>> +                    le32_to_cpu(hdr->payload_size));
>>>               break;
>>>           default:
>>>               soc_bind_err(tplg, control_hdr, i);
>>>               return -EINVAL;
>>>           }
>>> +        if (ret < 0) {
>>> +            dev_err(tplg->dev, "ASoC: invalid control\n");
>>> +            return ret;
>>> +        }
>>
>> Sounds good, but this happens in a loop, so would all the memory 
>> previously allocated by denum/dbytes/dmixer_create leak, or is it 
>> freed automatically somewhere else?
>>
> 
> Well, now that error is propagated, snd_soc_tplg_component_remove() 
> should be called by snd_soc_tplg_component_load() in case of errors 
> while parsing. From quick look it seems like it should be able to free 
> it up correctly by calling remove_enum/bytes/mixer.

I am not sure what you meant by 'should be called', if it's a 
recommendation for a future change or a description of the existing 
behavior.
Just to be clear, are you saying the existing code will take care of 
this error flow or that a new patch is needed?

  reply	other threads:[~2020-03-30 15:56 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 ` [PATCH v2 2/6] ASoC: topology: Check return value of soc_tplg_create_tlv Amadeusz Sławiński
2020-04-09 12:02   ` Applied "ASoC: topology: Check return value of soc_tplg_create_tlv" to the asoc tree 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 [this message]
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=8e03a294-3562-7e26-6654-a5b0f7970060@linux.intel.com \
    --to=pierre-louis.bossart@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=amadeuszx.slawinski@linux.intel.com \
    --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 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).