Commit 46bbf461 authored by Mark Brown's avatar Mark Brown

Merge series "ASoC: SOF: cleanups for 5.10" from Kai Vehmanen <kai.vehmanen@linux.intel.com>:

Series with multiple code cleanups, plus one fix to remove
unnecessary kernel warnings related to firmware loading.

Bard Liao (1):
  ASoC: SOF: loader: handle all SOF_IPC_EXT types

Pierre-Louis Bossart (3):
  ASoC: SOF: control: remove const in sizeof()
  ASoC: SOF: topology: remove const in sizeof()
  ASoC: SOF: sof-audio: remove goto used for force-nocodec support

 sound/soc/sof/control.c   | 20 ++++++++++----------
 sound/soc/sof/loader.c    |  5 +++++
 sound/soc/sof/sof-audio.c | 10 +++-------
 sound/soc/sof/topology.c  |  2 +-
 4 files changed, 19 insertions(+), 18 deletions(-)

--
2.27.0
parents 7a25748b 64e2c37e
...@@ -309,7 +309,7 @@ int snd_sof_bytes_ext_put(struct snd_kcontrol *kcontrol, ...@@ -309,7 +309,7 @@ int snd_sof_bytes_ext_put(struct snd_kcontrol *kcontrol,
* the length (as bytes) is needed to know the correct copy * the length (as bytes) is needed to know the correct copy
* length of data from tlvd->tlv. * length of data from tlvd->tlv.
*/ */
if (copy_from_user(&header, tlvd, sizeof(const struct snd_ctl_tlv))) if (copy_from_user(&header, tlvd, sizeof(struct snd_ctl_tlv)))
return -EFAULT; return -EFAULT;
/* make sure TLV info is consistent */ /* make sure TLV info is consistent */
...@@ -351,7 +351,7 @@ int snd_sof_bytes_ext_put(struct snd_kcontrol *kcontrol, ...@@ -351,7 +351,7 @@ int snd_sof_bytes_ext_put(struct snd_kcontrol *kcontrol,
} }
/* be->max has been verified to be >= sizeof(struct sof_abi_hdr) */ /* be->max has been verified to be >= sizeof(struct sof_abi_hdr) */
if (cdata->data->size > be->max - sizeof(const struct sof_abi_hdr)) { if (cdata->data->size > be->max - sizeof(struct sof_abi_hdr)) {
dev_err_ratelimited(scomp->dev, "error: Mismatch in ABI data size (truncated?).\n"); dev_err_ratelimited(scomp->dev, "error: Mismatch in ABI data size (truncated?).\n");
return -EINVAL; return -EINVAL;
} }
...@@ -405,15 +405,15 @@ int snd_sof_bytes_ext_volatile_get(struct snd_kcontrol *kcontrol, unsigned int _ ...@@ -405,15 +405,15 @@ int snd_sof_bytes_ext_volatile_get(struct snd_kcontrol *kcontrol, unsigned int _
goto out; goto out;
/* check data size doesn't exceed max coming from topology */ /* check data size doesn't exceed max coming from topology */
if (cdata->data->size > be->max - sizeof(const struct sof_abi_hdr)) { if (cdata->data->size > be->max - sizeof(struct sof_abi_hdr)) {
dev_err_ratelimited(scomp->dev, "error: user data size %d exceeds max size %zu.\n", dev_err_ratelimited(scomp->dev, "error: user data size %d exceeds max size %zu.\n",
cdata->data->size, cdata->data->size,
be->max - sizeof(const struct sof_abi_hdr)); be->max - sizeof(struct sof_abi_hdr));
ret = -EINVAL; ret = -EINVAL;
goto out; goto out;
} }
data_size = cdata->data->size + sizeof(const struct sof_abi_hdr); data_size = cdata->data->size + sizeof(struct sof_abi_hdr);
/* make sure we don't exceed size provided by user space for data */ /* make sure we don't exceed size provided by user space for data */
if (data_size > size) { if (data_size > size) {
...@@ -423,7 +423,7 @@ int snd_sof_bytes_ext_volatile_get(struct snd_kcontrol *kcontrol, unsigned int _ ...@@ -423,7 +423,7 @@ int snd_sof_bytes_ext_volatile_get(struct snd_kcontrol *kcontrol, unsigned int _
header.numid = scontrol->cmd; header.numid = scontrol->cmd;
header.length = data_size; header.length = data_size;
if (copy_to_user(tlvd, &header, sizeof(const struct snd_ctl_tlv))) { if (copy_to_user(tlvd, &header, sizeof(struct snd_ctl_tlv))) {
ret = -EFAULT; ret = -EFAULT;
goto out; goto out;
} }
...@@ -466,14 +466,14 @@ int snd_sof_bytes_ext_get(struct snd_kcontrol *kcontrol, ...@@ -466,14 +466,14 @@ int snd_sof_bytes_ext_get(struct snd_kcontrol *kcontrol,
cdata->data->abi = SOF_ABI_VERSION; cdata->data->abi = SOF_ABI_VERSION;
/* check data size doesn't exceed max coming from topology */ /* check data size doesn't exceed max coming from topology */
if (cdata->data->size > be->max - sizeof(const struct sof_abi_hdr)) { if (cdata->data->size > be->max - sizeof(struct sof_abi_hdr)) {
dev_err_ratelimited(scomp->dev, "error: user data size %d exceeds max size %zu.\n", dev_err_ratelimited(scomp->dev, "error: user data size %d exceeds max size %zu.\n",
cdata->data->size, cdata->data->size,
be->max - sizeof(const struct sof_abi_hdr)); be->max - sizeof(struct sof_abi_hdr));
return -EINVAL; return -EINVAL;
} }
data_size = cdata->data->size + sizeof(const struct sof_abi_hdr); data_size = cdata->data->size + sizeof(struct sof_abi_hdr);
/* make sure we don't exceed size provided by user space for data */ /* make sure we don't exceed size provided by user space for data */
if (data_size > size) if (data_size > size)
...@@ -481,7 +481,7 @@ int snd_sof_bytes_ext_get(struct snd_kcontrol *kcontrol, ...@@ -481,7 +481,7 @@ int snd_sof_bytes_ext_get(struct snd_kcontrol *kcontrol,
header.numid = scontrol->cmd; header.numid = scontrol->cmd;
header.length = data_size; header.length = data_size;
if (copy_to_user(tlvd, &header, sizeof(const struct snd_ctl_tlv))) if (copy_to_user(tlvd, &header, sizeof(struct snd_ctl_tlv)))
return -EFAULT; return -EFAULT;
if (copy_to_user(tlvd->tlv, cdata->data, data_size)) if (copy_to_user(tlvd->tlv, cdata->data, data_size))
......
...@@ -443,11 +443,7 @@ int sof_machine_check(struct snd_sof_dev *sdev) ...@@ -443,11 +443,7 @@ int sof_machine_check(struct snd_sof_dev *sdev)
struct snd_soc_acpi_mach *mach; struct snd_soc_acpi_mach *mach;
int ret; int ret;
/* force nocodec mode */ #if !IS_ENABLED(CONFIG_SND_SOC_SOF_FORCE_NOCODEC_MODE)
#if IS_ENABLED(CONFIG_SND_SOC_SOF_FORCE_NOCODEC_MODE)
dev_warn(sdev->dev, "Force to use nocodec mode\n");
goto nocodec;
#endif
/* find machine */ /* find machine */
snd_sof_machine_select(sdev); snd_sof_machine_select(sdev);
...@@ -460,8 +456,8 @@ int sof_machine_check(struct snd_sof_dev *sdev) ...@@ -460,8 +456,8 @@ int sof_machine_check(struct snd_sof_dev *sdev)
dev_err(sdev->dev, "error: no matching ASoC machine driver found - aborting probe\n"); dev_err(sdev->dev, "error: no matching ASoC machine driver found - aborting probe\n");
return -ENODEV; return -ENODEV;
#endif #endif
#if IS_ENABLED(CONFIG_SND_SOC_SOF_FORCE_NOCODEC_MODE) #else
nocodec: dev_warn(sdev->dev, "Force to use nocodec mode\n");
#endif #endif
/* select nocodec mode */ /* select nocodec mode */
dev_warn(sdev->dev, "Using nocodec machine driver\n"); dev_warn(sdev->dev, "Using nocodec machine driver\n");
......
...@@ -1201,7 +1201,7 @@ static int sof_control_load_bytes(struct snd_soc_component *scomp, ...@@ -1201,7 +1201,7 @@ static int sof_control_load_bytes(struct snd_soc_component *scomp,
ret = -EINVAL; ret = -EINVAL;
goto out_free; goto out_free;
} }
if (cdata->data->size + sizeof(const struct sof_abi_hdr) != if (cdata->data->size + sizeof(struct sof_abi_hdr) !=
le32_to_cpu(control->priv.size)) { le32_to_cpu(control->priv.size)) {
dev_err(scomp->dev, dev_err(scomp->dev,
"error: Conflict in bytes vs. priv size.\n"); "error: Conflict in bytes vs. priv size.\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment