aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sis190.c
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@vyatta.com>2008-04-27 08:36:59 -0400
committerFrancois Romieu <romieu@fr.zoreil.com>2008-04-27 08:36:59 -0400
commit4709aa59ede5ff9902d60088d93d1c0e2e9d2247 (patch)
tree8317f78faec39ab664dd28250923aff647c0dfab /drivers/net/sis190.c
parentf946dffed6334f08da065a89ed65026ebf8b33b4 (diff)
sis190: use the allocated buffer as a status code in sis190_alloc_rx_skb
The local status code does not carry mory information. Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Acked-by: Francois Romieu <romieu@fr.zoreil.com>
Diffstat (limited to 'drivers/net/sis190.c')
-rw-r--r--drivers/net/sis190.c37
1 files changed, 15 insertions, 22 deletions
diff --git a/drivers/net/sis190.c b/drivers/net/sis190.c
index 20745fd4e973..0d6aa1fc9c68 100644
--- a/drivers/net/sis190.c
+++ b/drivers/net/sis190.c
@@ -480,30 +480,22 @@ static inline void sis190_make_unusable_by_asic(struct RxDesc *desc)
480 desc->status = 0x0; 480 desc->status = 0x0;
481} 481}
482 482
483static int sis190_alloc_rx_skb(struct pci_dev *pdev, struct sk_buff **sk_buff, 483static struct sk_buff *sis190_alloc_rx_skb(struct pci_dev *pdev,
484 struct RxDesc *desc, u32 rx_buf_sz) 484 struct RxDesc *desc, u32 rx_buf_sz)
485{ 485{
486 struct sk_buff *skb; 486 struct sk_buff *skb;
487 dma_addr_t mapping;
488 int ret = 0;
489 487
490 skb = dev_alloc_skb(rx_buf_sz); 488 skb = dev_alloc_skb(rx_buf_sz);
491 if (!skb) 489 if (likely(skb)) {
492 goto err_out; 490 dma_addr_t mapping;
493
494 *sk_buff = skb;
495
496 mapping = pci_map_single(pdev, skb->data, rx_buf_sz,
497 PCI_DMA_FROMDEVICE);
498 491
499 sis190_map_to_asic(desc, mapping, rx_buf_sz); 492 mapping = pci_map_single(pdev, skb->data, rx_buf_sz,
500out: 493 PCI_DMA_FROMDEVICE);
501 return ret; 494 sis190_map_to_asic(desc, mapping, rx_buf_sz);
495 } else
496 sis190_make_unusable_by_asic(desc);
502 497
503err_out: 498 return skb;
504 ret = -ENOMEM;
505 sis190_make_unusable_by_asic(desc);
506 goto out;
507} 499}
508 500
509static u32 sis190_rx_fill(struct sis190_private *tp, struct net_device *dev, 501static u32 sis190_rx_fill(struct sis190_private *tp, struct net_device *dev,
@@ -512,14 +504,15 @@ static u32 sis190_rx_fill(struct sis190_private *tp, struct net_device *dev,
512 u32 cur; 504 u32 cur;
513 505
514 for (cur = start; cur < end; cur++) { 506 for (cur = start; cur < end; cur++) {
515 int ret, i = cur % NUM_RX_DESC; 507 unsigned int i = cur % NUM_RX_DESC;
516 508
517 if (tp->Rx_skbuff[i]) 509 if (tp->Rx_skbuff[i])
518 continue; 510 continue;
519 511
520 ret = sis190_alloc_rx_skb(tp->pci_dev, tp->Rx_skbuff + i, 512 tp->Rx_skbuff[i] = sis190_alloc_rx_skb(tp->pci_dev,
521 tp->RxDescRing + i, tp->rx_buf_sz); 513 tp->RxDescRing + i,
522 if (ret < 0) 514 tp->rx_buf_sz);
515 if (!tp->Rx_skbuff[i])
523 break; 516 break;
524 } 517 }
525 return cur - start; 518 return cur - start;