diff options
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-tx.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-tx.c | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-tx.c b/drivers/net/wireless/iwlwifi/iwl-tx.c index 4108c7c8f00f..78b1a7a4ca40 100644 --- a/drivers/net/wireless/iwlwifi/iwl-tx.c +++ b/drivers/net/wireless/iwlwifi/iwl-tx.c | |||
@@ -402,12 +402,11 @@ static int iwl_hw_tx_queue_init(struct iwl_priv *priv, | |||
402 | /** | 402 | /** |
403 | * iwl_tx_queue_init - Allocate and initialize one tx/cmd queue | 403 | * iwl_tx_queue_init - Allocate and initialize one tx/cmd queue |
404 | */ | 404 | */ |
405 | static int iwl_tx_queue_init(struct iwl_priv *priv, | 405 | static int iwl_tx_queue_init(struct iwl_priv *priv, struct iwl_tx_queue *txq, |
406 | struct iwl_tx_queue *txq, | ||
407 | int slots_num, u32 txq_id) | 406 | int slots_num, u32 txq_id) |
408 | { | 407 | { |
409 | int i, len; | 408 | int i, len; |
410 | int rc = 0; | 409 | int ret; |
411 | 410 | ||
412 | /* | 411 | /* |
413 | * Alloc buffer array for commands (Tx or other types of commands). | 412 | * Alloc buffer array for commands (Tx or other types of commands). |
@@ -426,19 +425,16 @@ static int iwl_tx_queue_init(struct iwl_priv *priv, | |||
426 | continue; | 425 | continue; |
427 | } | 426 | } |
428 | 427 | ||
429 | txq->cmd[i] = kmalloc(len, GFP_KERNEL | GFP_DMA); | 428 | txq->cmd[i] = kmalloc(len, GFP_KERNEL); |
430 | if (!txq->cmd[i]) | 429 | if (!txq->cmd[i]) |
431 | return -ENOMEM; | 430 | goto err; |
432 | } | 431 | } |
433 | 432 | ||
434 | /* Alloc driver data array and TFD circular buffer */ | 433 | /* Alloc driver data array and TFD circular buffer */ |
435 | rc = iwl_tx_queue_alloc(priv, txq, txq_id); | 434 | ret = iwl_tx_queue_alloc(priv, txq, txq_id); |
436 | if (rc) { | 435 | if (ret) |
437 | for (i = 0; i < slots_num; i++) | 436 | goto err; |
438 | kfree(txq->cmd[i]); | ||
439 | 437 | ||
440 | return -ENOMEM; | ||
441 | } | ||
442 | txq->need_update = 0; | 438 | txq->need_update = 0; |
443 | 439 | ||
444 | /* TFD_QUEUE_SIZE_MAX must be power-of-two size, otherwise | 440 | /* TFD_QUEUE_SIZE_MAX must be power-of-two size, otherwise |
@@ -452,6 +448,17 @@ static int iwl_tx_queue_init(struct iwl_priv *priv, | |||
452 | iwl_hw_tx_queue_init(priv, txq); | 448 | iwl_hw_tx_queue_init(priv, txq); |
453 | 449 | ||
454 | return 0; | 450 | return 0; |
451 | err: | ||
452 | for (i = 0; i < slots_num; i++) { | ||
453 | kfree(txq->cmd[i]); | ||
454 | txq->cmd[i] = NULL; | ||
455 | } | ||
456 | |||
457 | if (txq_id == IWL_CMD_QUEUE_NUM) { | ||
458 | kfree(txq->cmd[slots_num]); | ||
459 | txq->cmd[slots_num] = NULL; | ||
460 | } | ||
461 | return -ENOMEM; | ||
455 | } | 462 | } |
456 | /** | 463 | /** |
457 | * iwl_hw_txq_ctx_free - Free TXQ Context | 464 | * iwl_hw_txq_ctx_free - Free TXQ Context |
@@ -493,7 +500,7 @@ int iwl_txq_ctx_reset(struct iwl_priv *priv) | |||
493 | /* Alloc keep-warm buffer */ | 500 | /* Alloc keep-warm buffer */ |
494 | ret = iwl_kw_alloc(priv); | 501 | ret = iwl_kw_alloc(priv); |
495 | if (ret) { | 502 | if (ret) { |
496 | IWL_ERROR("Keep Warm allocation failed"); | 503 | IWL_ERROR("Keep Warm allocation failed\n"); |
497 | goto error_kw; | 504 | goto error_kw; |
498 | } | 505 | } |
499 | spin_lock_irqsave(&priv->lock, flags); | 506 | spin_lock_irqsave(&priv->lock, flags); |
@@ -1463,7 +1470,7 @@ void iwl_rx_reply_compressed_ba(struct iwl_priv *priv, | |||
1463 | u16 ba_resp_scd_ssn = le16_to_cpu(ba_resp->scd_ssn); | 1470 | u16 ba_resp_scd_ssn = le16_to_cpu(ba_resp->scd_ssn); |
1464 | 1471 | ||
1465 | if (scd_flow >= priv->hw_params.max_txq_num) { | 1472 | if (scd_flow >= priv->hw_params.max_txq_num) { |
1466 | IWL_ERROR("BUG_ON scd_flow is bigger than number of queues"); | 1473 | IWL_ERROR("BUG_ON scd_flow is bigger than number of queues\n"); |
1467 | return; | 1474 | return; |
1468 | } | 1475 | } |
1469 | 1476 | ||