Commit b9f8e138 authored by Guennadi Liakhovetski's avatar Guennadi Liakhovetski Committed by Mark Brown

ASoC: SOF: (cosmetic) remove redundant "ret" variable uses

In some cases no "ret" variable is even needed, those functions always
return 0 anyway, in other cases "ret" initialisation is redundant.
Signed-off-by: default avatarGuennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: default avatarRanjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: default avatarKai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20200917105633.2579047-6-kai.vehmanen@linux.intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 99ceec5c
...@@ -221,7 +221,6 @@ int snd_sof_bytes_get(struct snd_kcontrol *kcontrol, ...@@ -221,7 +221,6 @@ int snd_sof_bytes_get(struct snd_kcontrol *kcontrol,
struct sof_ipc_ctrl_data *cdata = scontrol->control_data; struct sof_ipc_ctrl_data *cdata = scontrol->control_data;
struct sof_abi_hdr *data = cdata->data; struct sof_abi_hdr *data = cdata->data;
size_t size; size_t size;
int ret = 0;
if (be->max > sizeof(ucontrol->value.bytes.data)) { if (be->max > sizeof(ucontrol->value.bytes.data)) {
dev_err_ratelimited(scomp->dev, dev_err_ratelimited(scomp->dev,
...@@ -235,15 +234,13 @@ int snd_sof_bytes_get(struct snd_kcontrol *kcontrol, ...@@ -235,15 +234,13 @@ int snd_sof_bytes_get(struct snd_kcontrol *kcontrol,
dev_err_ratelimited(scomp->dev, dev_err_ratelimited(scomp->dev,
"error: DSP sent %zu bytes max is %d\n", "error: DSP sent %zu bytes max is %d\n",
size, be->max); size, be->max);
ret = -EINVAL; return -EINVAL;
goto out;
} }
/* copy back to kcontrol */ /* copy back to kcontrol */
memcpy(ucontrol->value.bytes.data, data, size); memcpy(ucontrol->value.bytes.data, data, size);
out: return 0;
return ret;
} }
int snd_sof_bytes_put(struct snd_kcontrol *kcontrol, int snd_sof_bytes_put(struct snd_kcontrol *kcontrol,
...@@ -424,7 +421,6 @@ int snd_sof_bytes_ext_get(struct snd_kcontrol *kcontrol, ...@@ -424,7 +421,6 @@ int snd_sof_bytes_ext_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_tlv __user *tlvd = struct snd_ctl_tlv __user *tlvd =
(struct snd_ctl_tlv __user *)binary_data; (struct snd_ctl_tlv __user *)binary_data;
int data_size; int data_size;
int ret = 0;
/* /*
* Decrement the limit by ext bytes header size to * Decrement the limit by ext bytes header size to
...@@ -443,20 +439,16 @@ int snd_sof_bytes_ext_get(struct snd_kcontrol *kcontrol, ...@@ -443,20 +439,16 @@ int snd_sof_bytes_ext_get(struct snd_kcontrol *kcontrol,
if (data_size > be->max) { if (data_size > be->max) {
dev_err_ratelimited(scomp->dev, "error: user data size %d exceeds max size %d.\n", dev_err_ratelimited(scomp->dev, "error: user data size %d exceeds max size %d.\n",
data_size, be->max); data_size, be->max);
ret = -EINVAL; return -EINVAL;
goto out;
} }
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(const struct snd_ctl_tlv)))
ret = -EFAULT; return -EFAULT;
goto out;
}
if (copy_to_user(tlvd->tlv, cdata->data, data_size)) if (copy_to_user(tlvd->tlv, cdata->data, data_size))
ret = -EFAULT; return -EFAULT;
out: return 0;
return ret;
} }
...@@ -63,7 +63,7 @@ static int ipc_pcm_params(struct snd_sof_widget *swidget, int dir) ...@@ -63,7 +63,7 @@ static int ipc_pcm_params(struct snd_sof_widget *swidget, int dir)
struct sof_ipc_pcm_params pcm; struct sof_ipc_pcm_params pcm;
struct snd_pcm_hw_params *params; struct snd_pcm_hw_params *params;
struct snd_sof_pcm *spcm; struct snd_sof_pcm *spcm;
int ret = 0; int ret;
memset(&pcm, 0, sizeof(pcm)); memset(&pcm, 0, sizeof(pcm));
...@@ -121,7 +121,7 @@ static int ipc_trigger(struct snd_sof_widget *swidget, int cmd) ...@@ -121,7 +121,7 @@ static int ipc_trigger(struct snd_sof_widget *swidget, int cmd)
struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(scomp); struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(scomp);
struct sof_ipc_stream stream; struct sof_ipc_stream stream;
struct sof_ipc_reply reply; struct sof_ipc_reply reply;
int ret = 0; int ret;
/* set IPC stream params */ /* set IPC stream params */
stream.hdr.size = sizeof(stream); stream.hdr.size = sizeof(stream);
...@@ -1033,7 +1033,7 @@ static int sof_control_load_volume(struct snd_soc_component *scomp, ...@@ -1033,7 +1033,7 @@ static int sof_control_load_volume(struct snd_soc_component *scomp,
struct sof_ipc_ctrl_data *cdata; struct sof_ipc_ctrl_data *cdata;
int tlv[TLV_ITEMS]; int tlv[TLV_ITEMS];
unsigned int i; unsigned int i;
int ret = 0; int ret;
/* validate topology data */ /* validate topology data */
if (le32_to_cpu(mc->num_channels) > SND_SOC_TPLG_MAX_CHAN) { if (le32_to_cpu(mc->num_channels) > SND_SOC_TPLG_MAX_CHAN) {
...@@ -1098,7 +1098,7 @@ static int sof_control_load_volume(struct snd_soc_component *scomp, ...@@ -1098,7 +1098,7 @@ static int sof_control_load_volume(struct snd_soc_component *scomp,
dev_dbg(scomp->dev, "tplg: load kcontrol index %d chans %d\n", dev_dbg(scomp->dev, "tplg: load kcontrol index %d chans %d\n",
scontrol->comp_id, scontrol->num_channels); scontrol->comp_id, scontrol->num_channels);
return ret; return 0;
out_free_table: out_free_table:
if (le32_to_cpu(mc->max) > 1) if (le32_to_cpu(mc->max) > 1)
...@@ -1151,7 +1151,7 @@ static int sof_control_load_bytes(struct snd_soc_component *scomp, ...@@ -1151,7 +1151,7 @@ static int sof_control_load_bytes(struct snd_soc_component *scomp,
container_of(hdr, struct snd_soc_tplg_bytes_control, hdr); container_of(hdr, struct snd_soc_tplg_bytes_control, hdr);
struct soc_bytes_ext *sbe = (struct soc_bytes_ext *)kc->private_value; struct soc_bytes_ext *sbe = (struct soc_bytes_ext *)kc->private_value;
int max_size = sbe->max; int max_size = sbe->max;
int ret = 0; int ret;
/* init the get/put bytes data */ /* init the get/put bytes data */
scontrol->size = sizeof(struct sof_ipc_ctrl_data) + scontrol->size = sizeof(struct sof_ipc_ctrl_data) +
...@@ -1204,7 +1204,7 @@ static int sof_control_load_bytes(struct snd_soc_component *scomp, ...@@ -1204,7 +1204,7 @@ static int sof_control_load_bytes(struct snd_soc_component *scomp,
} }
} }
return ret; return 0;
out_free: out_free:
kfree(scontrol->control_data); kfree(scontrol->control_data);
...@@ -1223,7 +1223,7 @@ static int sof_control_load(struct snd_soc_component *scomp, int index, ...@@ -1223,7 +1223,7 @@ static int sof_control_load(struct snd_soc_component *scomp, int index,
struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(scomp); struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(scomp);
struct snd_soc_dobj *dobj; struct snd_soc_dobj *dobj;
struct snd_sof_control *scontrol; struct snd_sof_control *scontrol;
int ret = -EINVAL; int ret;
dev_dbg(scomp->dev, "tplg: load control type %d name : %s\n", dev_dbg(scomp->dev, "tplg: load control type %d name : %s\n",
hdr->type, hdr->name); hdr->type, hdr->name);
...@@ -1276,7 +1276,7 @@ static int sof_control_load(struct snd_soc_component *scomp, int index, ...@@ -1276,7 +1276,7 @@ static int sof_control_load(struct snd_soc_component *scomp, int index,
dobj->private = scontrol; dobj->private = scontrol;
list_add(&scontrol->list, &sdev->kcontrol_list); list_add(&scontrol->list, &sdev->kcontrol_list);
return ret; return 0;
} }
static int sof_control_unload(struct snd_soc_component *scomp, static int sof_control_unload(struct snd_soc_component *scomp,
...@@ -2659,7 +2659,7 @@ static int sof_dai_load(struct snd_soc_component *scomp, int index, ...@@ -2659,7 +2659,7 @@ static int sof_dai_load(struct snd_soc_component *scomp, int index,
struct snd_soc_tplg_private *private = &pcm->priv; struct snd_soc_tplg_private *private = &pcm->priv;
struct snd_sof_pcm *spcm; struct snd_sof_pcm *spcm;
int stream; int stream;
int ret = 0; int ret;
/* nothing to do for BEs atm */ /* nothing to do for BEs atm */
if (!pcm) if (!pcm)
...@@ -3350,7 +3350,6 @@ static int sof_link_hda_unload(struct snd_sof_dev *sdev, ...@@ -3350,7 +3350,6 @@ static int sof_link_hda_unload(struct snd_sof_dev *sdev,
struct snd_soc_dai_link *link) struct snd_soc_dai_link *link)
{ {
struct snd_soc_dai *dai; struct snd_soc_dai *dai;
int ret = 0;
dai = snd_soc_find_dai(link->cpus); dai = snd_soc_find_dai(link->cpus);
if (!dai) { if (!dai) {
...@@ -3359,7 +3358,7 @@ static int sof_link_hda_unload(struct snd_sof_dev *sdev, ...@@ -3359,7 +3358,7 @@ static int sof_link_hda_unload(struct snd_sof_dev *sdev,
return -EINVAL; return -EINVAL;
} }
return ret; return 0;
} }
static int sof_link_unload(struct snd_soc_component *scomp, static int sof_link_unload(struct snd_soc_component *scomp,
...@@ -3492,7 +3491,6 @@ static int sof_route_load(struct snd_soc_component *scomp, int index, ...@@ -3492,7 +3491,6 @@ static int sof_route_load(struct snd_soc_component *scomp, int index,
sink_swidget->id != snd_soc_dapm_buffer) { sink_swidget->id != snd_soc_dapm_buffer) {
dev_dbg(scomp->dev, "warning: neither Linked source component %s nor sink component %s is of buffer type, ignoring link\n", dev_dbg(scomp->dev, "warning: neither Linked source component %s nor sink component %s is of buffer type, ignoring link\n",
route->source, route->sink); route->source, route->sink);
ret = 0;
goto err; goto err;
} else { } else {
ret = sof_ipc_tx_message(sdev->ipc, ret = sof_ipc_tx_message(sdev->ipc,
...@@ -3526,7 +3524,7 @@ static int sof_route_load(struct snd_soc_component *scomp, int index, ...@@ -3526,7 +3524,7 @@ static int sof_route_load(struct snd_soc_component *scomp, int index,
/* add route to route list */ /* add route to route list */
list_add(&sroute->list, &sdev->route_list); list_add(&sroute->list, &sdev->route_list);
return ret; return 0;
} }
err: err:
......
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