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

staging: most: make function most_submit_mbo return void

Function most_submit_mbo() causes an exception only if either the pointer
mbo or mbo->context equals NULL. From the underlying architecture's point
of view both cases must _not_ come true and would happen only, if something
has tampered with the pointers. This would render runtime code unable to
recover anyway. So, instead trying to hide that things are already
critically out of control we're better off with a WARN_ON() assertion.

This patch replaces the return type of the function most_submit_mbo() with
'void' and adds a WARN_ONCE() assertion. Additionally, code calling the
function is adapted accordingly.
Signed-off-by: default avatarChristian Gromm <christian.gromm@microchip.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 95842bc9
...@@ -214,10 +214,7 @@ static ssize_t aim_write(struct file *filp, const char __user *buf, ...@@ -214,10 +214,7 @@ static ssize_t aim_write(struct file *filp, const char __user *buf,
goto put_mbo; goto put_mbo;
} }
ret = most_submit_mbo(mbo); most_submit_mbo(mbo);
if (ret)
goto put_mbo;
mutex_unlock(&c->io_mutex); mutex_unlock(&c->io_mutex);
return actual_len; return actual_len;
put_mbo: put_mbo:
......
...@@ -234,7 +234,6 @@ static int playback_thread(void *data) ...@@ -234,7 +234,6 @@ static int playback_thread(void *data)
while (!kthread_should_stop()) { while (!kthread_should_stop()) {
struct mbo *mbo = NULL; struct mbo *mbo = NULL;
bool period_elapsed = false; bool period_elapsed = false;
int ret;
wait_event_interruptible( wait_event_interruptible(
channel->playback_waitq, channel->playback_waitq,
...@@ -250,10 +249,7 @@ static int playback_thread(void *data) ...@@ -250,10 +249,7 @@ static int playback_thread(void *data)
else else
memset(mbo->virt_address, 0, mbo->buffer_length); memset(mbo->virt_address, 0, mbo->buffer_length);
ret = most_submit_mbo(mbo); most_submit_mbo(mbo);
if (ret)
channel->is_stream_running = false;
if (period_elapsed) if (period_elapsed)
snd_pcm_period_elapsed(channel->substream); snd_pcm_period_elapsed(channel->substream);
} }
......
...@@ -1323,17 +1323,14 @@ static int arm_mbo_chain(struct most_c_obj *c, int dir, ...@@ -1323,17 +1323,14 @@ static int arm_mbo_chain(struct most_c_obj *c, int dir,
/** /**
* most_submit_mbo - submits an MBO to fifo * most_submit_mbo - submits an MBO to fifo
* @mbo: pointer to the MBO * @mbo: pointer to the MBO
*
*/ */
int most_submit_mbo(struct mbo *mbo) void most_submit_mbo(struct mbo *mbo)
{ {
if (unlikely((!mbo) || (!mbo->context))) { if (WARN_ONCE(!mbo || !mbo->context,
pr_err("Bad MBO or missing channel reference\n"); "bad mbo or missing channel reference\n"))
return -EINVAL; return;
}
nq_hdm_mbo(mbo); nq_hdm_mbo(mbo);
return 0;
} }
EXPORT_SYMBOL_GPL(most_submit_mbo); EXPORT_SYMBOL_GPL(most_submit_mbo);
......
...@@ -287,7 +287,7 @@ struct kobject *most_register_interface(struct most_interface *iface); ...@@ -287,7 +287,7 @@ struct kobject *most_register_interface(struct most_interface *iface);
* @intf_instance Pointer to the interface instance description. * @intf_instance Pointer to the interface instance description.
*/ */
void most_deregister_interface(struct most_interface *iface); void most_deregister_interface(struct most_interface *iface);
int most_submit_mbo(struct mbo *mbo); void most_submit_mbo(struct mbo *mbo);
/** /**
* most_stop_enqueue - prevents core from enqueing MBOs * most_stop_enqueue - prevents core from enqueing MBOs
......
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