diff mbox

mwifiex: do not return success when command times out

Message ID 20150430235202.GA35256@dtor-ws
State Awaiting Upstream, archived
Delegated to: David Miller
Headers show

Commit Message

Dmitry Torokhov April 30, 2015, 11:52 p.m. UTC
wait_event_interruptible_timeout() returns 0 upon timeout. We should
convert it to a negative error code (such as -ETIMEDOUT) instead of
returning it directly, as return code of 0 indicates that command was
executed.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/net/wireless/mwifiex/sta_ioctl.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Kalle Valo May 9, 2015, 1:47 p.m. UTC | #1
> wait_event_interruptible_timeout() returns 0 upon timeout. We should
> convert it to a negative error code (such as -ETIMEDOUT) instead of
> returning it directly, as return code of 0 indicates that command was
> executed.
> 
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

Thanks, applied to wireless-drivers-next.git.

Kalle Valo
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/wireless/mwifiex/sta_ioctl.c b/drivers/net/wireless/mwifiex/sta_ioctl.c
index 0599e41..a0bc26c 100644
--- a/drivers/net/wireless/mwifiex/sta_ioctl.c
+++ b/drivers/net/wireless/mwifiex/sta_ioctl.c
@@ -64,6 +64,8 @@  int mwifiex_wait_queue_complete(struct mwifiex_adapter *adapter,
 						  *(cmd_queued->condition),
 						  (12 * HZ));
 	if (status <= 0) {
+		if (status == 0)
+			status = -ETIMEDOUT;
 		dev_err(adapter->dev, "cmd_wait_q terminated: %d\n", status);
 		mwifiex_cancel_all_pending_cmd(adapter);
 		return status;