diff options
author | Stephen Hemminger <shemminger@osdl.org> | 2006-01-06 19:57:43 -0500 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2006-01-09 10:32:41 -0500 |
commit | 162875570e65b56a7f4d804fc32aebf7a434cf89 (patch) | |
tree | 838b01f9dbc373ff3726bcaacef8e7808e98d3ab /drivers/net/sk98lin | |
parent | 26fc354914219a91254afd0df573fc801bb1183a (diff) |
[PATCH] sk98lin: error handling on probe
The sk98lin driver doesn't do proper error number handling
during initialization. Note: -EAGAIN is a bogus return value for
hardware errors.
Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
Diffstat (limited to 'drivers/net/sk98lin')
-rw-r--r-- | drivers/net/sk98lin/skge.c | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/drivers/net/sk98lin/skge.c b/drivers/net/sk98lin/skge.c index 9f89c23191d0..455417d5fcfb 100644 --- a/drivers/net/sk98lin/skge.c +++ b/drivers/net/sk98lin/skge.c | |||
@@ -530,7 +530,7 @@ SK_BOOL DualNet; | |||
530 | if (SkGeInit(pAC, pAC->IoBase, SK_INIT_DATA) != 0) { | 530 | if (SkGeInit(pAC, pAC->IoBase, SK_INIT_DATA) != 0) { |
531 | printk("HWInit (0) failed.\n"); | 531 | printk("HWInit (0) failed.\n"); |
532 | spin_unlock_irqrestore(&pAC->SlowPathLock, Flags); | 532 | spin_unlock_irqrestore(&pAC->SlowPathLock, Flags); |
533 | return(-EAGAIN); | 533 | return -EIO; |
534 | } | 534 | } |
535 | SkI2cInit( pAC, pAC->IoBase, SK_INIT_DATA); | 535 | SkI2cInit( pAC, pAC->IoBase, SK_INIT_DATA); |
536 | SkEventInit(pAC, pAC->IoBase, SK_INIT_DATA); | 536 | SkEventInit(pAC, pAC->IoBase, SK_INIT_DATA); |
@@ -552,7 +552,7 @@ SK_BOOL DualNet; | |||
552 | if (SkGeInit(pAC, pAC->IoBase, SK_INIT_IO) != 0) { | 552 | if (SkGeInit(pAC, pAC->IoBase, SK_INIT_IO) != 0) { |
553 | printk("sk98lin: HWInit (1) failed.\n"); | 553 | printk("sk98lin: HWInit (1) failed.\n"); |
554 | spin_unlock_irqrestore(&pAC->SlowPathLock, Flags); | 554 | spin_unlock_irqrestore(&pAC->SlowPathLock, Flags); |
555 | return(-EAGAIN); | 555 | return -EIO; |
556 | } | 556 | } |
557 | SkI2cInit( pAC, pAC->IoBase, SK_INIT_IO); | 557 | SkI2cInit( pAC, pAC->IoBase, SK_INIT_IO); |
558 | SkEventInit(pAC, pAC->IoBase, SK_INIT_IO); | 558 | SkEventInit(pAC, pAC->IoBase, SK_INIT_IO); |
@@ -584,20 +584,20 @@ SK_BOOL DualNet; | |||
584 | } else { | 584 | } else { |
585 | printk(KERN_WARNING "sk98lin: Illegal number of ports: %d\n", | 585 | printk(KERN_WARNING "sk98lin: Illegal number of ports: %d\n", |
586 | pAC->GIni.GIMacsFound); | 586 | pAC->GIni.GIMacsFound); |
587 | return -EAGAIN; | 587 | return -EIO; |
588 | } | 588 | } |
589 | 589 | ||
590 | if (Ret) { | 590 | if (Ret) { |
591 | printk(KERN_WARNING "sk98lin: Requested IRQ %d is busy.\n", | 591 | printk(KERN_WARNING "sk98lin: Requested IRQ %d is busy.\n", |
592 | dev->irq); | 592 | dev->irq); |
593 | return -EAGAIN; | 593 | return Ret; |
594 | } | 594 | } |
595 | pAC->AllocFlag |= SK_ALLOC_IRQ; | 595 | pAC->AllocFlag |= SK_ALLOC_IRQ; |
596 | 596 | ||
597 | /* Alloc memory for this board (Mem for RxD/TxD) : */ | 597 | /* Alloc memory for this board (Mem for RxD/TxD) : */ |
598 | if(!BoardAllocMem(pAC)) { | 598 | if(!BoardAllocMem(pAC)) { |
599 | printk("No memory for descriptor rings.\n"); | 599 | printk("No memory for descriptor rings.\n"); |
600 | return(-EAGAIN); | 600 | return -ENOMEM; |
601 | } | 601 | } |
602 | 602 | ||
603 | BoardInitMem(pAC); | 603 | BoardInitMem(pAC); |
@@ -613,7 +613,7 @@ SK_BOOL DualNet; | |||
613 | DualNet)) { | 613 | DualNet)) { |
614 | BoardFreeMem(pAC); | 614 | BoardFreeMem(pAC); |
615 | printk("sk98lin: SkGeInitAssignRamToQueues failed.\n"); | 615 | printk("sk98lin: SkGeInitAssignRamToQueues failed.\n"); |
616 | return(-EAGAIN); | 616 | return -EIO; |
617 | } | 617 | } |
618 | 618 | ||
619 | return (0); | 619 | return (0); |
@@ -4800,8 +4800,10 @@ static int __devinit skge_probe_one(struct pci_dev *pdev, | |||
4800 | } | 4800 | } |
4801 | } | 4801 | } |
4802 | 4802 | ||
4803 | if ((dev = alloc_etherdev(sizeof(DEV_NET))) == NULL) { | 4803 | error = -ENOMEM; |
4804 | printk(KERN_ERR "Unable to allocate etherdev " | 4804 | dev = alloc_etherdev(sizeof(DEV_NET)); |
4805 | if (!dev) { | ||
4806 | printk(KERN_ERR "sk98lin: unable to allocate etherdev " | ||
4805 | "structure!\n"); | 4807 | "structure!\n"); |
4806 | goto out_disable_device; | 4808 | goto out_disable_device; |
4807 | } | 4809 | } |
@@ -4809,7 +4811,7 @@ static int __devinit skge_probe_one(struct pci_dev *pdev, | |||
4809 | pNet = netdev_priv(dev); | 4811 | pNet = netdev_priv(dev); |
4810 | pNet->pAC = kzalloc(sizeof(SK_AC), GFP_KERNEL); | 4812 | pNet->pAC = kzalloc(sizeof(SK_AC), GFP_KERNEL); |
4811 | if (!pNet->pAC) { | 4813 | if (!pNet->pAC) { |
4812 | printk(KERN_ERR "Unable to allocate adapter " | 4814 | printk(KERN_ERR "sk98lin: unable to allocate adapter " |
4813 | "structure!\n"); | 4815 | "structure!\n"); |
4814 | goto out_free_netdev; | 4816 | goto out_free_netdev; |
4815 | } | 4817 | } |
@@ -4822,6 +4824,7 @@ static int __devinit skge_probe_one(struct pci_dev *pdev, | |||
4822 | pAC->CheckQueue = SK_FALSE; | 4824 | pAC->CheckQueue = SK_FALSE; |
4823 | 4825 | ||
4824 | dev->irq = pdev->irq; | 4826 | dev->irq = pdev->irq; |
4827 | |||
4825 | error = SkGeInitPCI(pAC); | 4828 | error = SkGeInitPCI(pAC); |
4826 | if (error) { | 4829 | if (error) { |
4827 | printk(KERN_ERR "sk98lin: PCI setup failed: %i\n", error); | 4830 | printk(KERN_ERR "sk98lin: PCI setup failed: %i\n", error); |
@@ -4861,17 +4864,20 @@ static int __devinit skge_probe_one(struct pci_dev *pdev, | |||
4861 | 4864 | ||
4862 | pAC->Index = boards_found++; | 4865 | pAC->Index = boards_found++; |
4863 | 4866 | ||
4864 | if (SkGeBoardInit(dev, pAC)) | 4867 | error = SkGeBoardInit(dev, pAC); |
4868 | if (error) | ||
4865 | goto out_free_netdev; | 4869 | goto out_free_netdev; |
4866 | 4870 | ||
4867 | /* Read Adapter name from VPD */ | 4871 | /* Read Adapter name from VPD */ |
4868 | if (ProductStr(pAC, DeviceStr, sizeof(DeviceStr)) != 0) { | 4872 | if (ProductStr(pAC, DeviceStr, sizeof(DeviceStr)) != 0) { |
4873 | error = -EIO; | ||
4869 | printk(KERN_ERR "sk98lin: Could not read VPD data.\n"); | 4874 | printk(KERN_ERR "sk98lin: Could not read VPD data.\n"); |
4870 | goto out_free_resources; | 4875 | goto out_free_resources; |
4871 | } | 4876 | } |
4872 | 4877 | ||
4873 | /* Register net device */ | 4878 | /* Register net device */ |
4874 | if (register_netdev(dev)) { | 4879 | error = register_netdev(dev); |
4880 | if (error) { | ||
4875 | printk(KERN_ERR "sk98lin: Could not register device.\n"); | 4881 | printk(KERN_ERR "sk98lin: Could not register device.\n"); |
4876 | goto out_free_resources; | 4882 | goto out_free_resources; |
4877 | } | 4883 | } |