Commit 95266dc0 authored by Vladimir Kondratiev's avatar Vladimir Kondratiev Committed by John W. Linville

wil6210: fix for unreachable code in wmi_recv_cmd

As reported by Dan Carpenter <dan.carpenter@oracle.com>:

The patch a715c7dd: "wil6210: improve debug for WMI receive" from
May 29, 2014, leads to the following static checker warning:

        drivers/net/wireless/ath/wil6210/wmi.c:746 wmi_recv_cmd()
        info: ignoring unreachable code.

drivers/net/wireless/ath/wil6210/wmi.c
   739                  spin_unlock_irqrestore(&wil->wmi_ev_lock, flags);
   740                  {
   741                          int q = queue_work(wil->wmi_wq,
   742                                             &wil->wmi_event_worker);
   743                          wil_dbg_wmi(wil, "queue_work -> %d\n", q);
   744                  }
   745          }
   746          if (n > 1)
                ^^^^^^^^^^
We never reach this if statemtent.

   747                  wil_dbg_wmi(wil, "%s -> %d events processed\n", __func__, n);
   748  }

Exit loop with "break", not "return".
Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarVladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent f8cd9f8b
...@@ -683,14 +683,12 @@ void wmi_recv_cmd(struct wil6210_priv *wil) ...@@ -683,14 +683,12 @@ void wmi_recv_cmd(struct wil6210_priv *wil)
for (n = 0;; n++) { for (n = 0;; n++) {
u16 len; u16 len;
bool q;
r->head = ioread32(wil->csr + HOST_MBOX + r->head = ioread32(wil->csr + HOST_MBOX +
offsetof(struct wil6210_mbox_ctl, rx.head)); offsetof(struct wil6210_mbox_ctl, rx.head));
if (r->tail == r->head) { if (r->tail == r->head)
if (n == 0) break;
wil_dbg_wmi(wil, "No events?\n");
return;
}
wil_dbg_wmi(wil, "Mbox head %08x tail %08x\n", wil_dbg_wmi(wil, "Mbox head %08x tail %08x\n",
r->head, r->tail); r->head, r->tail);
...@@ -699,14 +697,14 @@ void wmi_recv_cmd(struct wil6210_priv *wil) ...@@ -699,14 +697,14 @@ void wmi_recv_cmd(struct wil6210_priv *wil)
sizeof(struct wil6210_mbox_ring_desc)); sizeof(struct wil6210_mbox_ring_desc));
if (d_tail.sync == 0) { if (d_tail.sync == 0) {
wil_err(wil, "Mbox evt not owned by FW?\n"); wil_err(wil, "Mbox evt not owned by FW?\n");
return; break;
} }
/* read cmd header from descriptor */ /* read cmd header from descriptor */
if (0 != wmi_read_hdr(wil, d_tail.addr, &hdr)) { if (0 != wmi_read_hdr(wil, d_tail.addr, &hdr)) {
wil_err(wil, "Mbox evt at 0x%08x?\n", wil_err(wil, "Mbox evt at 0x%08x?\n",
le32_to_cpu(d_tail.addr)); le32_to_cpu(d_tail.addr));
return; break;
} }
len = le16_to_cpu(hdr.len); len = le16_to_cpu(hdr.len);
wil_dbg_wmi(wil, "Mbox evt %04x %04x %04x %02x\n", wil_dbg_wmi(wil, "Mbox evt %04x %04x %04x %02x\n",
...@@ -720,7 +718,7 @@ void wmi_recv_cmd(struct wil6210_priv *wil) ...@@ -720,7 +718,7 @@ void wmi_recv_cmd(struct wil6210_priv *wil)
event.wmi) + len, 4), event.wmi) + len, 4),
GFP_KERNEL); GFP_KERNEL);
if (!evt) if (!evt)
return; break;
evt->event.hdr = hdr; evt->event.hdr = hdr;
cmd = (void *)&evt->event.wmi; cmd = (void *)&evt->event.wmi;
...@@ -752,14 +750,11 @@ void wmi_recv_cmd(struct wil6210_priv *wil) ...@@ -752,14 +750,11 @@ void wmi_recv_cmd(struct wil6210_priv *wil)
spin_lock_irqsave(&wil->wmi_ev_lock, flags); spin_lock_irqsave(&wil->wmi_ev_lock, flags);
list_add_tail(&evt->list, &wil->pending_wmi_ev); list_add_tail(&evt->list, &wil->pending_wmi_ev);
spin_unlock_irqrestore(&wil->wmi_ev_lock, flags); spin_unlock_irqrestore(&wil->wmi_ev_lock, flags);
{ q = queue_work(wil->wmi_wq, &wil->wmi_event_worker);
int q = queue_work(wil->wmi_wq, wil_dbg_wmi(wil, "queue_work -> %d\n", q);
&wil->wmi_event_worker);
wil_dbg_wmi(wil, "queue_work -> %d\n", q);
}
} }
if (n > 1) /* normally, 1 event per IRQ should be processed */
wil_dbg_wmi(wil, "%s -> %d events processed\n", __func__, n); wil_dbg_wmi(wil, "%s -> %d events queued\n", __func__, n);
} }
int wmi_call(struct wil6210_priv *wil, u16 cmdid, void *buf, u16 len, int wmi_call(struct wil6210_priv *wil, u16 cmdid, void *buf, u16 len,
......
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