diff options
author | Stanislaw Gruszka <sgruszka@redhat.com> | 2013-02-13 09:49:08 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2013-02-14 14:24:07 -0500 |
commit | bdb084b22d8aee66c87af5e9c36bd6cf7f3bccfd (patch) | |
tree | 62cdfe1e5a6a6a71b43b7580338837661e579cf0 /drivers/net/wireless/iwlegacy/common.c | |
parent | 4ea545d476d3182056aeb042c439237ed61d261e (diff) |
iwlegacy: more checks for dma mapping errors
This patch check output of pci_map_single() calls. I missed them on
my previous patch "iwlegacy: check for dma mapping errors", which
fixed only pci_map_page() calls.
To handle remaining possible dma mappings errors, we need to rearrange
ilXXXX_tx_skb() and il_enqueue_hcmd() functions.
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlegacy/common.c')
-rw-r--r-- | drivers/net/wireless/iwlegacy/common.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/drivers/net/wireless/iwlegacy/common.c b/drivers/net/wireless/iwlegacy/common.c index 1f598604a79c..4ed2949f314d 100644 --- a/drivers/net/wireless/iwlegacy/common.c +++ b/drivers/net/wireless/iwlegacy/common.c | |||
@@ -3162,18 +3162,23 @@ il_enqueue_hcmd(struct il_priv *il, struct il_host_cmd *cmd) | |||
3162 | idx, il->cmd_queue); | 3162 | idx, il->cmd_queue); |
3163 | } | 3163 | } |
3164 | #endif | 3164 | #endif |
3165 | txq->need_update = 1; | ||
3166 | |||
3167 | if (il->ops->txq_update_byte_cnt_tbl) | ||
3168 | /* Set up entry in queue's byte count circular buffer */ | ||
3169 | il->ops->txq_update_byte_cnt_tbl(il, txq, 0); | ||
3170 | 3165 | ||
3171 | phys_addr = | 3166 | phys_addr = |
3172 | pci_map_single(il->pci_dev, &out_cmd->hdr, fix_size, | 3167 | pci_map_single(il->pci_dev, &out_cmd->hdr, fix_size, |
3173 | PCI_DMA_BIDIRECTIONAL); | 3168 | PCI_DMA_BIDIRECTIONAL); |
3169 | if (unlikely(pci_dma_mapping_error(il->pci_dev, phys_addr))) { | ||
3170 | idx = -ENOMEM; | ||
3171 | goto out; | ||
3172 | } | ||
3174 | dma_unmap_addr_set(out_meta, mapping, phys_addr); | 3173 | dma_unmap_addr_set(out_meta, mapping, phys_addr); |
3175 | dma_unmap_len_set(out_meta, len, fix_size); | 3174 | dma_unmap_len_set(out_meta, len, fix_size); |
3176 | 3175 | ||
3176 | txq->need_update = 1; | ||
3177 | |||
3178 | if (il->ops->txq_update_byte_cnt_tbl) | ||
3179 | /* Set up entry in queue's byte count circular buffer */ | ||
3180 | il->ops->txq_update_byte_cnt_tbl(il, txq, 0); | ||
3181 | |||
3177 | il->ops->txq_attach_buf_to_tfd(il, txq, phys_addr, fix_size, 1, | 3182 | il->ops->txq_attach_buf_to_tfd(il, txq, phys_addr, fix_size, 1, |
3178 | U32_PAD(cmd->len)); | 3183 | U32_PAD(cmd->len)); |
3179 | 3184 | ||
@@ -3181,6 +3186,7 @@ il_enqueue_hcmd(struct il_priv *il, struct il_host_cmd *cmd) | |||
3181 | q->write_ptr = il_queue_inc_wrap(q->write_ptr, q->n_bd); | 3186 | q->write_ptr = il_queue_inc_wrap(q->write_ptr, q->n_bd); |
3182 | il_txq_update_write_ptr(il, txq); | 3187 | il_txq_update_write_ptr(il, txq); |
3183 | 3188 | ||
3189 | out: | ||
3184 | spin_unlock_irqrestore(&il->hcmd_lock, flags); | 3190 | spin_unlock_irqrestore(&il->hcmd_lock, flags); |
3185 | return idx; | 3191 | return idx; |
3186 | } | 3192 | } |