From: Jaska Uimonen <jaska.uimonen@linux.intel.com>
To: alsa-devel@alsa-project.org
Cc: Jaska Uimonen <jaska.uimonen@intel.com>, broonie@kernel.org
Subject: [PATCH v2] ASoC: SOF: topology: fix get control data return type and arguments
Date: Thu, 22 Aug 2019 00:11:38 +0300 [thread overview]
Message-ID: <20190821211138.14618-1-jaska.uimonen@linux.intel.com> (raw)
From: Jaska Uimonen <jaska.uimonen@intel.com>
sof_get_control_data returns negative values even though the return
value is defined unsigned (size_t). So change the return value type to
int and add the data size as pointer argument to sof_get_control_data to
avoid ambiquity in the meaning of the return type.
Fixes: cac974a51ebb ("ASoC: SOF: topology: use set_get_data in process load")
Reported by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jaska Uimonen <jaska.uimonen@intel.com>
---
sound/soc/sof/topology.c | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)
diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c
index 28a7a6e06a53..fc85efbad378 100644
--- a/sound/soc/sof/topology.c
+++ b/sound/soc/sof/topology.c
@@ -1752,17 +1752,19 @@ static int sof_widget_load_siggen(struct snd_soc_component *scomp, int index,
return ret;
}
-static size_t sof_get_control_data(struct snd_sof_dev *sdev,
- struct snd_soc_dapm_widget *widget,
- struct sof_widget_data *wdata)
+static int sof_get_control_data(struct snd_sof_dev *sdev,
+ struct snd_soc_dapm_widget *widget,
+ struct sof_widget_data *wdata,
+ size_t *size)
{
const struct snd_kcontrol_new *kc;
struct soc_mixer_control *sm;
struct soc_bytes_ext *sbe;
struct soc_enum *se;
- size_t size = 0;
int i;
+ *size = 0;
+
for (i = 0; i < widget->num_kcontrols; i++) {
kc = &widget->kcontrol_news[i];
@@ -1800,7 +1802,7 @@ static size_t sof_get_control_data(struct snd_sof_dev *sdev,
if (wdata[i].pdata->magic != SOF_ABI_MAGIC)
return -EINVAL;
- size += wdata[i].pdata->size;
+ *size += wdata[i].pdata->size;
/* get data type */
switch (wdata[i].control->cmd) {
@@ -1819,7 +1821,7 @@ static size_t sof_get_control_data(struct snd_sof_dev *sdev,
}
}
- return size;
+ return 0;
}
static int sof_process_load(struct snd_soc_component *scomp, int index,
@@ -1855,12 +1857,11 @@ static int sof_process_load(struct snd_soc_component *scomp, int index,
return -ENOMEM;
/* get possible component controls and get size of all pdata */
- ipc_data_size = sof_get_control_data(sdev, widget, wdata);
+ ret = sof_get_control_data(sdev, widget, wdata,
+ &ipc_data_size);
- if (ipc_data_size <= 0) {
- ret = ipc_data_size;
+ if (ret < 0)
goto out;
- }
}
ipc_size = sizeof(struct sof_ipc_comp_process) +
--
2.13.6
next reply other threads:[~2019-08-21 21:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-21 21:11 Jaska Uimonen [this message]
2019-08-22 18:32 ` Applied "ASoC: SOF: topology: fix get control data return type and arguments" to the asoc tree Mark Brown
-- strict thread matches above, loose matches on Subject: below --
2019-08-21 13:21 [PATCH v2] ASoC: SOF: topology: fix get control data return type and arguments Jaska Uimonen
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=20190821211138.14618-1-jaska.uimonen@linux.intel.com \
--to=jaska.uimonen@linux.intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=jaska.uimonen@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