Skip to content

Commit 61243d8

Browse files
IvDoornlinvjw
authored andcommitted
rt2x00: Remove duplicate deinitialization
When rt2x00queue_alloc_rxskbs() fails rt2x00queue_unitialize() will be called which will free all rxskb. So we don't need to do this in the rt2x00queue_alloc_rxskb() function as well. rt2x00queue_free_skb() unmaps the DMA but doesn't clear the allocation flag. Since the code is copied from rt2x00queue_unmap_skb() anyway (and that function does clear the flag) we might as well use that function directly. Signed-off-by: Ivo van Doorn <[email protected]> Signed-off-by: John W. Linville <[email protected]>
1 parent 923fd70 commit 61243d8

File tree

1 file changed

+2
-18
lines changed

1 file changed

+2
-18
lines changed

drivers/net/wireless/rt2x00/rt2x00queue.c

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -107,18 +107,7 @@ void rt2x00queue_unmap_skb(struct rt2x00_dev *rt2x00dev, struct sk_buff *skb)
107107

108108
void rt2x00queue_free_skb(struct rt2x00_dev *rt2x00dev, struct sk_buff *skb)
109109
{
110-
struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb);
111-
112-
if (skbdesc->flags & SKBDESC_DMA_MAPPED_RX) {
113-
dma_unmap_single(rt2x00dev->dev, skbdesc->skb_dma, skb->len,
114-
DMA_FROM_DEVICE);
115-
}
116-
117-
if (skbdesc->flags & SKBDESC_DMA_MAPPED_TX) {
118-
dma_unmap_single(rt2x00dev->dev, skbdesc->skb_dma, skb->len,
119-
DMA_TO_DEVICE);
120-
}
121-
110+
rt2x00queue_unmap_skb(rt2x00dev, skb);
122111
dev_kfree_skb_any(skb);
123112
}
124113

@@ -509,16 +498,11 @@ static int rt2x00queue_alloc_rxskbs(struct rt2x00_dev *rt2x00dev,
509498
for (i = 0; i < queue->limit; i++) {
510499
skb = rt2x00queue_alloc_rxskb(rt2x00dev, &queue->entries[i]);
511500
if (!skb)
512-
goto exit;
501+
return -ENOMEM;
513502
queue->entries[i].skb = skb;
514503
}
515504

516505
return 0;
517-
518-
exit:
519-
rt2x00queue_free_skbs(rt2x00dev, queue);
520-
521-
return -ENOMEM;
522506
}
523507

524508
int rt2x00queue_initialize(struct rt2x00_dev *rt2x00dev)

0 commit comments

Comments
 (0)