diff options
-rw-r--r-- | drivers/net/korina.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/net/korina.c b/drivers/net/korina.c index 6df9d253cc0a..51ca54c8ec57 100644 --- a/drivers/net/korina.c +++ b/drivers/net/korina.c | |||
@@ -750,7 +750,7 @@ static struct ethtool_ops netdev_ethtool_ops = { | |||
750 | .get_link = netdev_get_link, | 750 | .get_link = netdev_get_link, |
751 | }; | 751 | }; |
752 | 752 | ||
753 | static void korina_alloc_ring(struct net_device *dev) | 753 | static int korina_alloc_ring(struct net_device *dev) |
754 | { | 754 | { |
755 | struct korina_private *lp = netdev_priv(dev); | 755 | struct korina_private *lp = netdev_priv(dev); |
756 | struct sk_buff *skb; | 756 | struct sk_buff *skb; |
@@ -771,7 +771,7 @@ static void korina_alloc_ring(struct net_device *dev) | |||
771 | for (i = 0; i < KORINA_NUM_RDS; i++) { | 771 | for (i = 0; i < KORINA_NUM_RDS; i++) { |
772 | skb = dev_alloc_skb(KORINA_RBSIZE + 2); | 772 | skb = dev_alloc_skb(KORINA_RBSIZE + 2); |
773 | if (!skb) | 773 | if (!skb) |
774 | break; | 774 | return -ENOMEM; |
775 | skb_reserve(skb, 2); | 775 | skb_reserve(skb, 2); |
776 | lp->rx_skb[i] = skb; | 776 | lp->rx_skb[i] = skb; |
777 | lp->rd_ring[i].control = DMA_DESC_IOD | | 777 | lp->rd_ring[i].control = DMA_DESC_IOD | |
@@ -790,6 +790,8 @@ static void korina_alloc_ring(struct net_device *dev) | |||
790 | lp->rx_chain_head = 0; | 790 | lp->rx_chain_head = 0; |
791 | lp->rx_chain_tail = 0; | 791 | lp->rx_chain_tail = 0; |
792 | lp->rx_chain_status = desc_empty; | 792 | lp->rx_chain_status = desc_empty; |
793 | |||
794 | return 0; | ||
793 | } | 795 | } |
794 | 796 | ||
795 | static void korina_free_ring(struct net_device *dev) | 797 | static void korina_free_ring(struct net_device *dev) |
@@ -832,7 +834,11 @@ static int korina_init(struct net_device *dev) | |||
832 | writel(ETH_INT_FC_EN, &lp->eth_regs->ethintfc); | 834 | writel(ETH_INT_FC_EN, &lp->eth_regs->ethintfc); |
833 | 835 | ||
834 | /* Allocate rings */ | 836 | /* Allocate rings */ |
835 | korina_alloc_ring(dev); | 837 | if (korina_alloc_ring(dev)) { |
838 | printk(KERN_ERR "%s: descriptor allocation failed\n", dev->name); | ||
839 | korina_free_ring(dev); | ||
840 | return -ENOMEM; | ||
841 | } | ||
836 | 842 | ||
837 | writel(0, &lp->rx_dma_regs->dmas); | 843 | writel(0, &lp->rx_dma_regs->dmas); |
838 | /* Start Rx DMA */ | 844 | /* Start Rx DMA */ |