summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
diff options
context:
space:
mode:
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>2011-09-23 00:14:53 +0200
committerJohn W. Linville <linville@tuxdriver.com>2011-09-27 20:34:07 +0200
commit7f90dce1ea9de432cf1f196c743a8d5a119e38ba (patch)
treea0168ed953d421deb1f669984c11e1808d1a11b4 /drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
parentiwlagn: update rate scaling with BA notifications (diff)
downloadlinux-7f90dce1ea9de432cf1f196c743a8d5a119e38ba.tar.xz
linux-7f90dce1ea9de432cf1f196c743a8d5a119e38ba.zip
iwlagn: use kcalloc when possible for array allocation
As everybody knows kcalloc checks the multiplication is safe and that we don't run into overflow. Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-trans-pcie.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-trans-pcie.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c b/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
index 781f6aa81df9..416e9920e4d9 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
+++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
@@ -304,8 +304,8 @@ static int iwl_trans_txq_alloc(struct iwl_trans *trans,
txq->q.n_window = slots_num;
- txq->meta = kzalloc(sizeof(txq->meta[0]) * slots_num, GFP_KERNEL);
- txq->cmd = kzalloc(sizeof(txq->cmd[0]) * slots_num, GFP_KERNEL);
+ txq->meta = kcalloc(slots_num, sizeof(txq->meta[0]), GFP_KERNEL);
+ txq->cmd = kcalloc(slots_num, sizeof(txq->cmd[0]), GFP_KERNEL);
if (!txq->meta || !txq->cmd)
goto error;
@@ -322,8 +322,8 @@ static int iwl_trans_txq_alloc(struct iwl_trans *trans,
/* Driver private data, only for Tx (not command) queues,
* not shared with device. */
if (txq_id != trans->shrd->cmd_queue) {
- txq->skbs = kzalloc(sizeof(txq->skbs[0]) *
- TFD_QUEUE_SIZE_MAX, GFP_KERNEL);
+ txq->skbs = kcalloc(TFD_QUEUE_SIZE_MAX, sizeof(txq->skbs[0]),
+ GFP_KERNEL);
if (!txq->skbs) {
IWL_ERR(trans, "kmalloc for auxiliary BD "
"structures failed\n");
@@ -534,8 +534,8 @@ static int iwl_trans_tx_alloc(struct iwl_trans *trans)
goto error;
}
- trans_pcie->txq = kzalloc(sizeof(struct iwl_tx_queue) *
- hw_params(trans).max_txq_num, GFP_KERNEL);
+ trans_pcie->txq = kcalloc(hw_params(trans).max_txq_num,
+ sizeof(struct iwl_tx_queue), GFP_KERNEL);
if (!trans_pcie->txq) {
IWL_ERR(trans, "Not enough memory for txq\n");
ret = ENOMEM;