diff options
author | Yogesh Ashok Powar <yogeshp@marvell.com> | 2011-11-08 00:41:10 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-11-11 12:32:48 -0500 |
commit | 8ed1303321914a70ad580c1d034898e43c39b065 (patch) | |
tree | 6f550887cfb2d18a3e2e174ceba1a30483b711c2 | |
parent | 63af63330f4c8b4fdcc13dec082dea3b81d53b0a (diff) |
mwifiex: fix 'Smatch' warnings
Following three warnings are fixed:
>init.c +256 mwifiex_init_adapter(71)
>warn: variable dereferenced before check 'adapter->sleep_cfm'
>(see line 191)
>sta_rx.c +193 mwifiex_process_sta_rx_packet(75)
>warn: variable dereferenced before check 'priv' (see line 182)
Signed-off-by: Yogesh Ashok Powar <yogeshp@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/mwifiex/init.c | 4 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/sta_rx.c | 12 |
2 files changed, 9 insertions, 7 deletions
diff --git a/drivers/net/wireless/mwifiex/init.c b/drivers/net/wireless/mwifiex/init.c index d792b3fb7c16..26940455255b 100644 --- a/drivers/net/wireless/mwifiex/init.c +++ b/drivers/net/wireless/mwifiex/init.c | |||
@@ -187,8 +187,6 @@ static void mwifiex_init_adapter(struct mwifiex_adapter *adapter) | |||
187 | struct mwifiex_opt_sleep_confirm *sleep_cfm_buf = NULL; | 187 | struct mwifiex_opt_sleep_confirm *sleep_cfm_buf = NULL; |
188 | 188 | ||
189 | skb_put(adapter->sleep_cfm, sizeof(struct mwifiex_opt_sleep_confirm)); | 189 | skb_put(adapter->sleep_cfm, sizeof(struct mwifiex_opt_sleep_confirm)); |
190 | sleep_cfm_buf = (struct mwifiex_opt_sleep_confirm *) | ||
191 | (adapter->sleep_cfm->data); | ||
192 | 190 | ||
193 | adapter->cmd_sent = false; | 191 | adapter->cmd_sent = false; |
194 | 192 | ||
@@ -254,6 +252,8 @@ static void mwifiex_init_adapter(struct mwifiex_adapter *adapter) | |||
254 | mwifiex_wmm_init(adapter); | 252 | mwifiex_wmm_init(adapter); |
255 | 253 | ||
256 | if (adapter->sleep_cfm) { | 254 | if (adapter->sleep_cfm) { |
255 | sleep_cfm_buf = (struct mwifiex_opt_sleep_confirm *) | ||
256 | adapter->sleep_cfm->data; | ||
257 | memset(sleep_cfm_buf, 0, adapter->sleep_cfm->len); | 257 | memset(sleep_cfm_buf, 0, adapter->sleep_cfm->len); |
258 | sleep_cfm_buf->command = | 258 | sleep_cfm_buf->command = |
259 | cpu_to_le16(HostCmd_CMD_802_11_PS_MODE_ENH); | 259 | cpu_to_le16(HostCmd_CMD_802_11_PS_MODE_ENH); |
diff --git a/drivers/net/wireless/mwifiex/sta_rx.c b/drivers/net/wireless/mwifiex/sta_rx.c index 27430512f7cd..5e1ef7e5da4f 100644 --- a/drivers/net/wireless/mwifiex/sta_rx.c +++ b/drivers/net/wireless/mwifiex/sta_rx.c | |||
@@ -126,6 +126,9 @@ int mwifiex_process_sta_rx_packet(struct mwifiex_adapter *adapter, | |||
126 | u16 rx_pkt_type; | 126 | u16 rx_pkt_type; |
127 | struct mwifiex_private *priv = adapter->priv[rx_info->bss_index]; | 127 | struct mwifiex_private *priv = adapter->priv[rx_info->bss_index]; |
128 | 128 | ||
129 | if (!priv) | ||
130 | return -1; | ||
131 | |||
129 | local_rx_pd = (struct rxpd *) (skb->data); | 132 | local_rx_pd = (struct rxpd *) (skb->data); |
130 | rx_pkt_type = local_rx_pd->rx_pkt_type; | 133 | rx_pkt_type = local_rx_pd->rx_pkt_type; |
131 | 134 | ||
@@ -189,12 +192,11 @@ int mwifiex_process_sta_rx_packet(struct mwifiex_adapter *adapter, | |||
189 | (u8) local_rx_pd->rx_pkt_type, | 192 | (u8) local_rx_pd->rx_pkt_type, |
190 | skb); | 193 | skb); |
191 | 194 | ||
192 | if (ret || (rx_pkt_type == PKT_TYPE_BAR)) { | 195 | if (ret || (rx_pkt_type == PKT_TYPE_BAR)) |
193 | if (priv && (ret == -1)) | ||
194 | priv->stats.rx_dropped++; | ||
195 | |||
196 | dev_kfree_skb_any(skb); | 196 | dev_kfree_skb_any(skb); |
197 | } | 197 | |
198 | if (ret) | ||
199 | priv->stats.rx_dropped++; | ||
198 | 200 | ||
199 | return ret; | 201 | return ret; |
200 | } | 202 | } |