aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2009-07-24 14:13:06 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-07-27 15:24:22 -0400
commit5696aea6f243e40013d2b00cd140fd006ec20b9c (patch)
treea40223f42ac20cb82492ae0844992434d27f5379 /drivers/net/wireless/iwlwifi
parentc2acea8e9b86ba5a5469ff477445676a223af4e2 (diff)
iwlwifi: remove command callback return value
No existing callbacks use anything other than the return value 1, which means that the caller should free the reply skb, so it seems safer in terms of not introducing memory leaks to simply remove the return value and let the caller always free the skb. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: Reinette Chatre <reinette.chatre@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945-led.c7
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.h6
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-dev.h12
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-hcmd.c21
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-sta.c26
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-tx.c4
6 files changed, 33 insertions, 43 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-led.c b/drivers/net/wireless/iwlwifi/iwl-3945-led.c
index b37938217f53..8c29ded7d02c 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945-led.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945-led.c
@@ -79,11 +79,10 @@ static const struct {
79#define IWL_MAX_BLINK_TBL (ARRAY_SIZE(blink_tbl) - 1) /*Exclude Solid on*/ 79#define IWL_MAX_BLINK_TBL (ARRAY_SIZE(blink_tbl) - 1) /*Exclude Solid on*/
80#define IWL_SOLID_BLINK_IDX (ARRAY_SIZE(blink_tbl) - 1) 80#define IWL_SOLID_BLINK_IDX (ARRAY_SIZE(blink_tbl) - 1)
81 81
82static int iwl3945_led_cmd_callback(struct iwl_priv *priv, 82static void iwl3945_led_cmd_callback(struct iwl_priv *priv,
83 struct iwl_device_cmd *cmd, 83 struct iwl_device_cmd *cmd,
84 struct sk_buff *skb) 84 struct sk_buff *skb)
85{ 85{
86 return 1;
87} 86}
88 87
89static inline int iwl3945_brightness_to_idx(enum led_brightness brightness) 88static inline int iwl3945_brightness_to_idx(enum led_brightness brightness)
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h
index 4156debec39c..febcf76e1d41 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.h
+++ b/drivers/net/wireless/iwlwifi/iwl-core.h
@@ -446,9 +446,9 @@ int __must_check iwl_send_cmd_pdu(struct iwl_priv *priv, u8 id,
446 u16 len, const void *data); 446 u16 len, const void *data);
447int iwl_send_cmd_pdu_async(struct iwl_priv *priv, u8 id, u16 len, 447int iwl_send_cmd_pdu_async(struct iwl_priv *priv, u8 id, u16 len,
448 const void *data, 448 const void *data,
449 int (*callback)(struct iwl_priv *priv, 449 void (*callback)(struct iwl_priv *priv,
450 struct iwl_device_cmd *cmd, 450 struct iwl_device_cmd *cmd,
451 struct sk_buff *skb)); 451 struct sk_buff *skb));
452 452
453int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd); 453int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd);
454 454
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
index ce765f79275a..3ca188a95926 100644
--- a/drivers/net/wireless/iwlwifi/iwl-dev.h
+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
@@ -163,9 +163,9 @@ struct iwl_cmd_meta {
163 * invoked for SYNC commands, if it were and its result passed 163 * invoked for SYNC commands, if it were and its result passed
164 * through it would be simpler...) 164 * through it would be simpler...)
165 */ 165 */
166 int (*callback)(struct iwl_priv *priv, 166 void (*callback)(struct iwl_priv *priv,
167 struct iwl_device_cmd *cmd, 167 struct iwl_device_cmd *cmd,
168 struct sk_buff *skb); 168 struct sk_buff *skb);
169 169
170 /* The CMD_SIZE_HUGE flag bit indicates that the command 170 /* The CMD_SIZE_HUGE flag bit indicates that the command
171 * structure is stored at the end of the shared queue memory. */ 171 * structure is stored at the end of the shared queue memory. */
@@ -383,9 +383,9 @@ struct iwl_device_cmd {
383struct iwl_host_cmd { 383struct iwl_host_cmd {
384 const void *data; 384 const void *data;
385 struct sk_buff *reply_skb; 385 struct sk_buff *reply_skb;
386 int (*callback)(struct iwl_priv *priv, 386 void (*callback)(struct iwl_priv *priv,
387 struct iwl_device_cmd *cmd, 387 struct iwl_device_cmd *cmd,
388 struct sk_buff *skb); 388 struct sk_buff *skb);
389 u32 flags; 389 u32 flags;
390 u16 len; 390 u16 len;
391 u8 id; 391 u8 id;
diff --git a/drivers/net/wireless/iwlwifi/iwl-hcmd.c b/drivers/net/wireless/iwlwifi/iwl-hcmd.c
index d8a3eac8ceb7..b82ad15d5189 100644
--- a/drivers/net/wireless/iwlwifi/iwl-hcmd.c
+++ b/drivers/net/wireless/iwlwifi/iwl-hcmd.c
@@ -103,23 +103,23 @@ EXPORT_SYMBOL(get_cmd_string);
103 103
104#define HOST_COMPLETE_TIMEOUT (HZ / 2) 104#define HOST_COMPLETE_TIMEOUT (HZ / 2)
105 105
106static int iwl_generic_cmd_callback(struct iwl_priv *priv, 106static void iwl_generic_cmd_callback(struct iwl_priv *priv,
107 struct iwl_device_cmd *cmd, 107 struct iwl_device_cmd *cmd,
108 struct sk_buff *skb) 108 struct sk_buff *skb)
109{ 109{
110 struct iwl_rx_packet *pkt = NULL; 110 struct iwl_rx_packet *pkt = NULL;
111 111
112 if (!skb) { 112 if (!skb) {
113 IWL_ERR(priv, "Error: Response NULL in %s.\n", 113 IWL_ERR(priv, "Error: Response NULL in %s.\n",
114 get_cmd_string(cmd->hdr.cmd)); 114 get_cmd_string(cmd->hdr.cmd));
115 return 1; 115 return;
116 } 116 }
117 117
118 pkt = (struct iwl_rx_packet *)skb->data; 118 pkt = (struct iwl_rx_packet *)skb->data;
119 if (pkt->hdr.flags & IWL_CMD_FAILED_MSK) { 119 if (pkt->hdr.flags & IWL_CMD_FAILED_MSK) {
120 IWL_ERR(priv, "Bad return from %s (0x%08X)\n", 120 IWL_ERR(priv, "Bad return from %s (0x%08X)\n",
121 get_cmd_string(cmd->hdr.cmd), pkt->hdr.flags); 121 get_cmd_string(cmd->hdr.cmd), pkt->hdr.flags);
122 return 1; 122 return;
123 } 123 }
124 124
125#ifdef CONFIG_IWLWIFI_DEBUG 125#ifdef CONFIG_IWLWIFI_DEBUG
@@ -128,15 +128,12 @@ static int iwl_generic_cmd_callback(struct iwl_priv *priv,
128 case SENSITIVITY_CMD: 128 case SENSITIVITY_CMD:
129 IWL_DEBUG_HC_DUMP(priv, "back from %s (0x%08X)\n", 129 IWL_DEBUG_HC_DUMP(priv, "back from %s (0x%08X)\n",
130 get_cmd_string(cmd->hdr.cmd), pkt->hdr.flags); 130 get_cmd_string(cmd->hdr.cmd), pkt->hdr.flags);
131 break; 131 break;
132 default: 132 default:
133 IWL_DEBUG_HC(priv, "back from %s (0x%08X)\n", 133 IWL_DEBUG_HC(priv, "back from %s (0x%08X)\n",
134 get_cmd_string(cmd->hdr.cmd), pkt->hdr.flags); 134 get_cmd_string(cmd->hdr.cmd), pkt->hdr.flags);
135 } 135 }
136#endif 136#endif
137
138 /* Let iwl_tx_complete free the response skb */
139 return 1;
140} 137}
141 138
142static int iwl_send_cmd_async(struct iwl_priv *priv, struct iwl_host_cmd *cmd) 139static int iwl_send_cmd_async(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
@@ -275,9 +272,9 @@ EXPORT_SYMBOL(iwl_send_cmd_pdu);
275 272
276int iwl_send_cmd_pdu_async(struct iwl_priv *priv, 273int iwl_send_cmd_pdu_async(struct iwl_priv *priv,
277 u8 id, u16 len, const void *data, 274 u8 id, u16 len, const void *data,
278 int (*callback)(struct iwl_priv *priv, 275 void (*callback)(struct iwl_priv *priv,
279 struct iwl_device_cmd *cmd, 276 struct iwl_device_cmd *cmd,
280 struct sk_buff *skb)) 277 struct sk_buff *skb))
281{ 278{
282 struct iwl_host_cmd cmd = { 279 struct iwl_host_cmd cmd = {
283 .id = id, 280 .id = id,
diff --git a/drivers/net/wireless/iwlwifi/iwl-sta.c b/drivers/net/wireless/iwlwifi/iwl-sta.c
index 1571ace05dde..79ea5cc2c89a 100644
--- a/drivers/net/wireless/iwlwifi/iwl-sta.c
+++ b/drivers/net/wireless/iwlwifi/iwl-sta.c
@@ -97,9 +97,9 @@ static void iwl_sta_ucode_activate(struct iwl_priv *priv, u8 sta_id)
97 spin_unlock_irqrestore(&priv->sta_lock, flags); 97 spin_unlock_irqrestore(&priv->sta_lock, flags);
98} 98}
99 99
100static int iwl_add_sta_callback(struct iwl_priv *priv, 100static void iwl_add_sta_callback(struct iwl_priv *priv,
101 struct iwl_device_cmd *cmd, 101 struct iwl_device_cmd *cmd,
102 struct sk_buff *skb) 102 struct sk_buff *skb)
103{ 103{
104 struct iwl_rx_packet *res = NULL; 104 struct iwl_rx_packet *res = NULL;
105 struct iwl_addsta_cmd *addsta = 105 struct iwl_addsta_cmd *addsta =
@@ -108,14 +108,14 @@ static int iwl_add_sta_callback(struct iwl_priv *priv,
108 108
109 if (!skb) { 109 if (!skb) {
110 IWL_ERR(priv, "Error: Response NULL in REPLY_ADD_STA.\n"); 110 IWL_ERR(priv, "Error: Response NULL in REPLY_ADD_STA.\n");
111 return 1; 111 return;
112 } 112 }
113 113
114 res = (struct iwl_rx_packet *)skb->data; 114 res = (struct iwl_rx_packet *)skb->data;
115 if (res->hdr.flags & IWL_CMD_FAILED_MSK) { 115 if (res->hdr.flags & IWL_CMD_FAILED_MSK) {
116 IWL_ERR(priv, "Bad return from REPLY_ADD_STA (0x%08X)\n", 116 IWL_ERR(priv, "Bad return from REPLY_ADD_STA (0x%08X)\n",
117 res->hdr.flags); 117 res->hdr.flags);
118 return 1; 118 return;
119 } 119 }
120 120
121 switch (res->u.add_sta.status) { 121 switch (res->u.add_sta.status) {
@@ -127,9 +127,6 @@ static int iwl_add_sta_callback(struct iwl_priv *priv,
127 res->u.add_sta.status); 127 res->u.add_sta.status);
128 break; 128 break;
129 } 129 }
130
131 /* We didn't cache the SKB; let the caller free it */
132 return 1;
133} 130}
134 131
135int iwl_send_add_sta(struct iwl_priv *priv, 132int iwl_send_add_sta(struct iwl_priv *priv,
@@ -325,9 +322,9 @@ static void iwl_sta_ucode_deactivate(struct iwl_priv *priv, const char *addr)
325 spin_unlock_irqrestore(&priv->sta_lock, flags); 322 spin_unlock_irqrestore(&priv->sta_lock, flags);
326} 323}
327 324
328static int iwl_remove_sta_callback(struct iwl_priv *priv, 325static void iwl_remove_sta_callback(struct iwl_priv *priv,
329 struct iwl_device_cmd *cmd, 326 struct iwl_device_cmd *cmd,
330 struct sk_buff *skb) 327 struct sk_buff *skb)
331{ 328{
332 struct iwl_rx_packet *res = NULL; 329 struct iwl_rx_packet *res = NULL;
333 struct iwl_rem_sta_cmd *rm_sta = 330 struct iwl_rem_sta_cmd *rm_sta =
@@ -336,14 +333,14 @@ static int iwl_remove_sta_callback(struct iwl_priv *priv,
336 333
337 if (!skb) { 334 if (!skb) {
338 IWL_ERR(priv, "Error: Response NULL in REPLY_REMOVE_STA.\n"); 335 IWL_ERR(priv, "Error: Response NULL in REPLY_REMOVE_STA.\n");
339 return 1; 336 return;
340 } 337 }
341 338
342 res = (struct iwl_rx_packet *)skb->data; 339 res = (struct iwl_rx_packet *)skb->data;
343 if (res->hdr.flags & IWL_CMD_FAILED_MSK) { 340 if (res->hdr.flags & IWL_CMD_FAILED_MSK) {
344 IWL_ERR(priv, "Bad return from REPLY_REMOVE_STA (0x%08X)\n", 341 IWL_ERR(priv, "Bad return from REPLY_REMOVE_STA (0x%08X)\n",
345 res->hdr.flags); 342 res->hdr.flags);
346 return 1; 343 return;
347 } 344 }
348 345
349 switch (res->u.rem_sta.status) { 346 switch (res->u.rem_sta.status) {
@@ -354,9 +351,6 @@ static int iwl_remove_sta_callback(struct iwl_priv *priv,
354 IWL_ERR(priv, "REPLY_REMOVE_STA failed\n"); 351 IWL_ERR(priv, "REPLY_REMOVE_STA failed\n");
355 break; 352 break;
356 } 353 }
357
358 /* We didn't cache the SKB; let the caller free it */
359 return 1;
360} 354}
361 355
362static int iwl_send_remove_station(struct iwl_priv *priv, const u8 *addr, 356static int iwl_send_remove_station(struct iwl_priv *priv, const u8 *addr,
diff --git a/drivers/net/wireless/iwlwifi/iwl-tx.c b/drivers/net/wireless/iwlwifi/iwl-tx.c
index 51ddbab63c23..e1558db97ec4 100644
--- a/drivers/net/wireless/iwlwifi/iwl-tx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-tx.c
@@ -1144,8 +1144,8 @@ void iwl_tx_cmd_complete(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb)
1144 if (meta->flags & CMD_WANT_SKB) { 1144 if (meta->flags & CMD_WANT_SKB) {
1145 meta->source->reply_skb = rxb->skb; 1145 meta->source->reply_skb = rxb->skb;
1146 rxb->skb = NULL; 1146 rxb->skb = NULL;
1147 } else if (meta->callback && !meta->callback(priv, cmd, rxb->skb)) 1147 } else if (meta->callback)
1148 rxb->skb = NULL; 1148 meta->callback(priv, cmd, rxb->skb);
1149 1149
1150 iwl_hcmd_queue_reclaim(priv, txq_id, index, cmd_index); 1150 iwl_hcmd_queue_reclaim(priv, txq_id, index, cmd_index);
1151 1151