Commit b1abd84d authored by Christian Gromm's avatar Christian Gromm Committed by Greg Kroah-Hartman

staging: most: sound: fix return values

This patch returns the proper values when reporting an error
to the caller.
Signed-off-by: default avatarChristian Gromm <christian.gromm@microchip.com>
Link: https://lore.kernel.org/r/1592924855-25569-4-git-send-email-christian.gromm@microchip.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 36b67efe
...@@ -278,6 +278,7 @@ static int pcm_open(struct snd_pcm_substream *substream) ...@@ -278,6 +278,7 @@ static int pcm_open(struct snd_pcm_substream *substream)
struct channel *channel = substream->private_data; struct channel *channel = substream->private_data;
struct snd_pcm_runtime *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
struct most_channel_config *cfg = channel->cfg; struct most_channel_config *cfg = channel->cfg;
int ret;
channel->substream = substream; channel->substream = substream;
...@@ -290,11 +291,12 @@ static int pcm_open(struct snd_pcm_substream *substream) ...@@ -290,11 +291,12 @@ static int pcm_open(struct snd_pcm_substream *substream)
} }
} }
if (most_start_channel(channel->iface, channel->id, &comp)) { ret = most_start_channel(channel->iface, channel->id, &comp);
if (ret) {
pr_err("most_start_channel() failed!\n"); pr_err("most_start_channel() failed!\n");
if (cfg->direction == MOST_CH_TX) if (cfg->direction == MOST_CH_TX)
kthread_stop(channel->playback_task); kthread_stop(channel->playback_task);
return -EBUSY; return ret;
} }
runtime->hw = channel->pcm_hardware; runtime->hw = channel->pcm_hardware;
...@@ -444,7 +446,7 @@ static int split_arg_list(char *buf, u16 *ch_num, char **sample_res) ...@@ -444,7 +446,7 @@ static int split_arg_list(char *buf, u16 *ch_num, char **sample_res)
err: err:
pr_err("Bad PCM format\n"); pr_err("Bad PCM format\n");
return -EIO; return -EINVAL;
} }
static const struct sample_resolution_info { static const struct sample_resolution_info {
...@@ -469,7 +471,7 @@ static int audio_set_hw_params(struct snd_pcm_hardware *pcm_hw, ...@@ -469,7 +471,7 @@ static int audio_set_hw_params(struct snd_pcm_hardware *pcm_hw,
goto found; goto found;
} }
pr_err("Unsupported PCM format\n"); pr_err("Unsupported PCM format\n");
return -EIO; return -EINVAL;
found: found:
if (!ch_num) { if (!ch_num) {
...@@ -580,7 +582,7 @@ static int audio_probe_channel(struct most_interface *iface, int channel_id, ...@@ -580,7 +582,7 @@ static int audio_probe_channel(struct most_interface *iface, int channel_id,
if (get_channel(iface, channel_id)) { if (get_channel(iface, channel_id)) {
pr_err("channel (%s:%d) is already linked\n", pr_err("channel (%s:%d) is already linked\n",
iface->description, channel_id); iface->description, channel_id);
return -EINVAL; return -EEXIST;
} }
if (cfg->direction == MOST_CH_TX) { if (cfg->direction == MOST_CH_TX) {
......
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