From: Bing Zhao Date: Thu, 3 Jan 2013 01:45:19 +0000 (-0800) Subject: UPSTREAM: mwifiex: check wait_event_interruptible return value X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=1975ee83115e63a22a35b880dc3184866ab49200;p=people%2Faperard%2Flinux-chromebook.git UPSTREAM: mwifiex: check wait_event_interruptible return value wait_event_interruptible function returns -ERESTARTSYS if it's interrupted by a signal. Driver should check the return value and handle this case properly. In mwifiex_wait_queue_complete() routine, as we are now checking wait_event_interruptible return value, the condition check is not required. Also, we have removed mwifiex_cancel_pending_ioctl() call to avoid a chance of sending second command to FW by other path as soon as we clear current command node. FW can not handle two commands simultaneously. Cc: "3.6+" Signed-off-by: Bing Zhao Signed-off-by: Amitkumar Karwar BUG=chrome-os-partner:16031,17015 TEST=Boot, associate, and run "rtcwake -s 10 -mmem" in a "while/do/done" loop Change-Id: I54deddb71864a5b638a559b9e51942bf1d46162d Reviewed-on: https://gerrit.chromium.org/gerrit/40359 Reviewed-by: Paul Stewart Commit-Queue: Bing Zhao Tested-by: Bing Zhao --- diff --git a/drivers/net/wireless/mwifiex/sta_ioctl.c b/drivers/net/wireless/mwifiex/sta_ioctl.c index fb22b4c08e8e4..e5bbe6b58a8af 100644 --- a/drivers/net/wireless/mwifiex/sta_ioctl.c +++ b/drivers/net/wireless/mwifiex/sta_ioctl.c @@ -56,7 +56,6 @@ int mwifiex_copy_mcast_addr(struct mwifiex_multicast_list *mlist, */ int mwifiex_wait_queue_complete(struct mwifiex_adapter *adapter) { - bool cancel_flag = false; int status; struct cmd_ctrl_node *cmd_queued; @@ -70,14 +69,11 @@ int mwifiex_wait_queue_complete(struct mwifiex_adapter *adapter) atomic_inc(&adapter->cmd_pending); /* Wait for completion */ - wait_event_interruptible(adapter->cmd_wait_q.wait, - *(cmd_queued->condition)); - if (!*(cmd_queued->condition)) - cancel_flag = true; - - if (cancel_flag) { - mwifiex_cancel_pending_ioctl(adapter); - dev_dbg(adapter->dev, "cmd cancel\n"); + status = wait_event_interruptible(adapter->cmd_wait_q.wait, + *(cmd_queued->condition)); + if (status) { + dev_err(adapter->dev, "cmd_wait_q terminated: %d\n", status); + return status; } status = adapter->cmd_wait_q.status; @@ -479,8 +475,11 @@ int mwifiex_enable_hs(struct mwifiex_adapter *adapter) return false; } - wait_event_interruptible(adapter->hs_activate_wait_q, - adapter->hs_activate_wait_q_woken); + if (wait_event_interruptible(adapter->hs_activate_wait_q, + adapter->hs_activate_wait_q_woken)) { + dev_err(adapter->dev, "hs_activate_wait_q terminated\n"); + return false; + } return true; }