alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: "Péter Ujfalusi" <peter.ujfalusi@linux.intel.com>
To: Dan Carpenter <error27@gmail.com>
Cc: lgirdwood@gmail.com, broonie@kernel.org,
	alsa-devel@alsa-project.org,
	pierre-louis.bossart@linux.intel.com,
	ranjani.sridharan@linux.intel.com, kai.vehmanen@linux.intel.com
Subject: Re: [PATCH] ASoC: SOF: ipc4-control: Return on error in sof_ipc4_widget_kcontrol_setup()
Date: Tue, 21 Mar 2023 16:40:05 +0200	[thread overview]
Message-ID: <692de037-f69f-be82-7f8c-a00e03952c53@linux.intel.com> (raw)
In-Reply-To: <c6e2f1d2-bdc0-4028-a9c3-5a077e52722d@kili.mountain>



On 21/03/2023 16:16, Dan Carpenter wrote:
> On Tue, Mar 21, 2023 at 03:49:19PM +0200, Peter Ujfalusi wrote:
>> The patch adding the bytes control support moved the error check outside
>> of the list_for_each_entry() which will cause issues when we will have
>> support for multiple controls per widgets.
> 
> Even now it causes an issue.  We're exiting the list_for_each_entry()
> without hitting a break statement so the scontrol points to somewhere
> in the middle of the sdev instead of to a valid scontrol entry.
> 
> The scontrol->comp_id will be some garbage value.

I'm not sure what you see
ret = 0;
list_for_each_entry(scontrol, &sdev->kcontrol_list, list) {
	if (scontrol->comp_id == swidget->comp_id) {
		switch (scontrol->info_type) {
		...
		}

		if (ret < 0) {
			/* scontrol is still valid and not changed */
			dev_err();
			return ret;
		}
	}
}

I think this is correct, I could have the ret check one level up, but no
point  of doing it if scontrol->comp_id != swidget->comp_id

-- 
Péter

  reply	other threads:[~2023-03-21 14:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-21 13:49 [PATCH] ASoC: SOF: ipc4-control: Return on error in sof_ipc4_widget_kcontrol_setup() Peter Ujfalusi
2023-03-21 14:16 ` Dan Carpenter
2023-03-21 14:40   ` Péter Ujfalusi [this message]
2023-03-21 14:46     ` Dan Carpenter
2023-03-21 14:48       ` Péter Ujfalusi
2023-03-22  6:36       ` Péter Ujfalusi
2023-03-23 13:49 ` Mark Brown

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=692de037-f69f-be82-7f8c-a00e03952c53@linux.intel.com \
    --to=peter.ujfalusi@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=error27@gmail.com \
    --cc=kai.vehmanen@linux.intel.com \
    --cc=lgirdwood@gmail.com \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=ranjani.sridharan@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).