提交 5696aea6 编写于 作者: J Johannes Berg 提交者: John W. Linville

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: NJohannes Berg <johannes@sipsolutions.net>
Signed-off-by: NReinette Chatre <reinette.chatre@intel.com>
Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
上级 c2acea8e
...@@ -79,11 +79,10 @@ static const struct { ...@@ -79,11 +79,10 @@ static const struct {
#define IWL_MAX_BLINK_TBL (ARRAY_SIZE(blink_tbl) - 1) /*Exclude Solid on*/ #define IWL_MAX_BLINK_TBL (ARRAY_SIZE(blink_tbl) - 1) /*Exclude Solid on*/
#define IWL_SOLID_BLINK_IDX (ARRAY_SIZE(blink_tbl) - 1) #define IWL_SOLID_BLINK_IDX (ARRAY_SIZE(blink_tbl) - 1)
static int iwl3945_led_cmd_callback(struct iwl_priv *priv, static void iwl3945_led_cmd_callback(struct iwl_priv *priv,
struct iwl_device_cmd *cmd, struct iwl_device_cmd *cmd,
struct sk_buff *skb) struct sk_buff *skb)
{ {
return 1;
} }
static inline int iwl3945_brightness_to_idx(enum led_brightness brightness) static inline int iwl3945_brightness_to_idx(enum led_brightness brightness)
......
...@@ -446,9 +446,9 @@ int __must_check iwl_send_cmd_pdu(struct iwl_priv *priv, u8 id, ...@@ -446,9 +446,9 @@ int __must_check iwl_send_cmd_pdu(struct iwl_priv *priv, u8 id,
u16 len, const void *data); u16 len, const void *data);
int iwl_send_cmd_pdu_async(struct iwl_priv *priv, u8 id, u16 len, int iwl_send_cmd_pdu_async(struct iwl_priv *priv, u8 id, u16 len,
const void *data, const void *data,
int (*callback)(struct iwl_priv *priv, void (*callback)(struct iwl_priv *priv,
struct iwl_device_cmd *cmd, struct iwl_device_cmd *cmd,
struct sk_buff *skb)); struct sk_buff *skb));
int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd); int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd);
......
...@@ -163,9 +163,9 @@ struct iwl_cmd_meta { ...@@ -163,9 +163,9 @@ struct iwl_cmd_meta {
* invoked for SYNC commands, if it were and its result passed * invoked for SYNC commands, if it were and its result passed
* through it would be simpler...) * through it would be simpler...)
*/ */
int (*callback)(struct iwl_priv *priv, void (*callback)(struct iwl_priv *priv,
struct iwl_device_cmd *cmd, struct iwl_device_cmd *cmd,
struct sk_buff *skb); struct sk_buff *skb);
/* The CMD_SIZE_HUGE flag bit indicates that the command /* The CMD_SIZE_HUGE flag bit indicates that the command
* structure is stored at the end of the shared queue memory. */ * structure is stored at the end of the shared queue memory. */
...@@ -383,9 +383,9 @@ struct iwl_device_cmd { ...@@ -383,9 +383,9 @@ struct iwl_device_cmd {
struct iwl_host_cmd { struct iwl_host_cmd {
const void *data; const void *data;
struct sk_buff *reply_skb; struct sk_buff *reply_skb;
int (*callback)(struct iwl_priv *priv, void (*callback)(struct iwl_priv *priv,
struct iwl_device_cmd *cmd, struct iwl_device_cmd *cmd,
struct sk_buff *skb); struct sk_buff *skb);
u32 flags; u32 flags;
u16 len; u16 len;
u8 id; u8 id;
......
...@@ -103,23 +103,23 @@ EXPORT_SYMBOL(get_cmd_string); ...@@ -103,23 +103,23 @@ EXPORT_SYMBOL(get_cmd_string);
#define HOST_COMPLETE_TIMEOUT (HZ / 2) #define HOST_COMPLETE_TIMEOUT (HZ / 2)
static int iwl_generic_cmd_callback(struct iwl_priv *priv, static void iwl_generic_cmd_callback(struct iwl_priv *priv,
struct iwl_device_cmd *cmd, struct iwl_device_cmd *cmd,
struct sk_buff *skb) struct sk_buff *skb)
{ {
struct iwl_rx_packet *pkt = NULL; struct iwl_rx_packet *pkt = NULL;
if (!skb) { if (!skb) {
IWL_ERR(priv, "Error: Response NULL in %s.\n", IWL_ERR(priv, "Error: Response NULL in %s.\n",
get_cmd_string(cmd->hdr.cmd)); get_cmd_string(cmd->hdr.cmd));
return 1; return;
} }
pkt = (struct iwl_rx_packet *)skb->data; pkt = (struct iwl_rx_packet *)skb->data;
if (pkt->hdr.flags & IWL_CMD_FAILED_MSK) { if (pkt->hdr.flags & IWL_CMD_FAILED_MSK) {
IWL_ERR(priv, "Bad return from %s (0x%08X)\n", IWL_ERR(priv, "Bad return from %s (0x%08X)\n",
get_cmd_string(cmd->hdr.cmd), pkt->hdr.flags); get_cmd_string(cmd->hdr.cmd), pkt->hdr.flags);
return 1; return;
} }
#ifdef CONFIG_IWLWIFI_DEBUG #ifdef CONFIG_IWLWIFI_DEBUG
...@@ -128,15 +128,12 @@ static int iwl_generic_cmd_callback(struct iwl_priv *priv, ...@@ -128,15 +128,12 @@ static int iwl_generic_cmd_callback(struct iwl_priv *priv,
case SENSITIVITY_CMD: case SENSITIVITY_CMD:
IWL_DEBUG_HC_DUMP(priv, "back from %s (0x%08X)\n", IWL_DEBUG_HC_DUMP(priv, "back from %s (0x%08X)\n",
get_cmd_string(cmd->hdr.cmd), pkt->hdr.flags); get_cmd_string(cmd->hdr.cmd), pkt->hdr.flags);
break; break;
default: default:
IWL_DEBUG_HC(priv, "back from %s (0x%08X)\n", IWL_DEBUG_HC(priv, "back from %s (0x%08X)\n",
get_cmd_string(cmd->hdr.cmd), pkt->hdr.flags); get_cmd_string(cmd->hdr.cmd), pkt->hdr.flags);
} }
#endif #endif
/* Let iwl_tx_complete free the response skb */
return 1;
} }
static int iwl_send_cmd_async(struct iwl_priv *priv, struct iwl_host_cmd *cmd) static 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,9 +272,9 @@ EXPORT_SYMBOL(iwl_send_cmd_pdu);
int iwl_send_cmd_pdu_async(struct iwl_priv *priv, int iwl_send_cmd_pdu_async(struct iwl_priv *priv,
u8 id, u16 len, const void *data, u8 id, u16 len, const void *data,
int (*callback)(struct iwl_priv *priv, void (*callback)(struct iwl_priv *priv,
struct iwl_device_cmd *cmd, struct iwl_device_cmd *cmd,
struct sk_buff *skb)) struct sk_buff *skb))
{ {
struct iwl_host_cmd cmd = { struct iwl_host_cmd cmd = {
.id = id, .id = id,
......
...@@ -97,9 +97,9 @@ static void iwl_sta_ucode_activate(struct iwl_priv *priv, u8 sta_id) ...@@ -97,9 +97,9 @@ static void iwl_sta_ucode_activate(struct iwl_priv *priv, u8 sta_id)
spin_unlock_irqrestore(&priv->sta_lock, flags); spin_unlock_irqrestore(&priv->sta_lock, flags);
} }
static int iwl_add_sta_callback(struct iwl_priv *priv, static void iwl_add_sta_callback(struct iwl_priv *priv,
struct iwl_device_cmd *cmd, struct iwl_device_cmd *cmd,
struct sk_buff *skb) struct sk_buff *skb)
{ {
struct iwl_rx_packet *res = NULL; struct iwl_rx_packet *res = NULL;
struct iwl_addsta_cmd *addsta = struct iwl_addsta_cmd *addsta =
...@@ -108,14 +108,14 @@ static int iwl_add_sta_callback(struct iwl_priv *priv, ...@@ -108,14 +108,14 @@ static int iwl_add_sta_callback(struct iwl_priv *priv,
if (!skb) { if (!skb) {
IWL_ERR(priv, "Error: Response NULL in REPLY_ADD_STA.\n"); IWL_ERR(priv, "Error: Response NULL in REPLY_ADD_STA.\n");
return 1; return;
} }
res = (struct iwl_rx_packet *)skb->data; res = (struct iwl_rx_packet *)skb->data;
if (res->hdr.flags & IWL_CMD_FAILED_MSK) { if (res->hdr.flags & IWL_CMD_FAILED_MSK) {
IWL_ERR(priv, "Bad return from REPLY_ADD_STA (0x%08X)\n", IWL_ERR(priv, "Bad return from REPLY_ADD_STA (0x%08X)\n",
res->hdr.flags); res->hdr.flags);
return 1; return;
} }
switch (res->u.add_sta.status) { switch (res->u.add_sta.status) {
...@@ -127,9 +127,6 @@ static int iwl_add_sta_callback(struct iwl_priv *priv, ...@@ -127,9 +127,6 @@ static int iwl_add_sta_callback(struct iwl_priv *priv,
res->u.add_sta.status); res->u.add_sta.status);
break; break;
} }
/* We didn't cache the SKB; let the caller free it */
return 1;
} }
int iwl_send_add_sta(struct iwl_priv *priv, int 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,9 +322,9 @@ static void iwl_sta_ucode_deactivate(struct iwl_priv *priv, const char *addr)
spin_unlock_irqrestore(&priv->sta_lock, flags); spin_unlock_irqrestore(&priv->sta_lock, flags);
} }
static int iwl_remove_sta_callback(struct iwl_priv *priv, static void iwl_remove_sta_callback(struct iwl_priv *priv,
struct iwl_device_cmd *cmd, struct iwl_device_cmd *cmd,
struct sk_buff *skb) struct sk_buff *skb)
{ {
struct iwl_rx_packet *res = NULL; struct iwl_rx_packet *res = NULL;
struct iwl_rem_sta_cmd *rm_sta = struct iwl_rem_sta_cmd *rm_sta =
...@@ -336,14 +333,14 @@ static int iwl_remove_sta_callback(struct iwl_priv *priv, ...@@ -336,14 +333,14 @@ static int iwl_remove_sta_callback(struct iwl_priv *priv,
if (!skb) { if (!skb) {
IWL_ERR(priv, "Error: Response NULL in REPLY_REMOVE_STA.\n"); IWL_ERR(priv, "Error: Response NULL in REPLY_REMOVE_STA.\n");
return 1; return;
} }
res = (struct iwl_rx_packet *)skb->data; res = (struct iwl_rx_packet *)skb->data;
if (res->hdr.flags & IWL_CMD_FAILED_MSK) { if (res->hdr.flags & IWL_CMD_FAILED_MSK) {
IWL_ERR(priv, "Bad return from REPLY_REMOVE_STA (0x%08X)\n", IWL_ERR(priv, "Bad return from REPLY_REMOVE_STA (0x%08X)\n",
res->hdr.flags); res->hdr.flags);
return 1; return;
} }
switch (res->u.rem_sta.status) { switch (res->u.rem_sta.status) {
...@@ -354,9 +351,6 @@ static int iwl_remove_sta_callback(struct iwl_priv *priv, ...@@ -354,9 +351,6 @@ static int iwl_remove_sta_callback(struct iwl_priv *priv,
IWL_ERR(priv, "REPLY_REMOVE_STA failed\n"); IWL_ERR(priv, "REPLY_REMOVE_STA failed\n");
break; break;
} }
/* We didn't cache the SKB; let the caller free it */
return 1;
} }
static int iwl_send_remove_station(struct iwl_priv *priv, const u8 *addr, static int iwl_send_remove_station(struct iwl_priv *priv, const u8 *addr,
......
...@@ -1144,8 +1144,8 @@ void iwl_tx_cmd_complete(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb) ...@@ -1144,8 +1144,8 @@ void iwl_tx_cmd_complete(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb)
if (meta->flags & CMD_WANT_SKB) { if (meta->flags & CMD_WANT_SKB) {
meta->source->reply_skb = rxb->skb; meta->source->reply_skb = rxb->skb;
rxb->skb = NULL; rxb->skb = NULL;
} else if (meta->callback && !meta->callback(priv, cmd, rxb->skb)) } else if (meta->callback)
rxb->skb = NULL; meta->callback(priv, cmd, rxb->skb);
iwl_hcmd_queue_reclaim(priv, txq_id, index, cmd_index); iwl_hcmd_queue_reclaim(priv, txq_id, index, cmd_index);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册