Commit 984fac04 authored by François Romieu's avatar François Romieu Committed by Jeff Garzik

[PATCH] via-velocity: properly manage the count of adapters

velocity_nics wasn't managed properly.
Signed-off-by: default avatarTejun Heo <tj@home-tj.org>
parent 61033167
...@@ -359,6 +359,8 @@ static void __devexit velocity_remove1(struct pci_dev *pdev) ...@@ -359,6 +359,8 @@ static void __devexit velocity_remove1(struct pci_dev *pdev)
pci_disable_device(pdev); pci_disable_device(pdev);
pci_set_drvdata(pdev, NULL); pci_set_drvdata(pdev, NULL);
free_netdev(dev); free_netdev(dev);
velocity_nics--;
} }
/** /**
...@@ -695,7 +697,7 @@ static int __devinit velocity_found1(struct pci_dev *pdev, const struct pci_devi ...@@ -695,7 +697,7 @@ static int __devinit velocity_found1(struct pci_dev *pdev, const struct pci_devi
struct mac_regs * regs; struct mac_regs * regs;
int ret = -ENOMEM; int ret = -ENOMEM;
if (velocity_nics++ >= MAX_UNITS) { if (velocity_nics >= MAX_UNITS) {
printk(KERN_NOTICE VELOCITY_NAME ": already found %d NICs.\n", printk(KERN_NOTICE VELOCITY_NAME ": already found %d NICs.\n",
velocity_nics); velocity_nics);
return -ENODEV; return -ENODEV;
...@@ -762,7 +764,7 @@ static int __devinit velocity_found1(struct pci_dev *pdev, const struct pci_devi ...@@ -762,7 +764,7 @@ static int __devinit velocity_found1(struct pci_dev *pdev, const struct pci_devi
dev->dev_addr[i] = readb(&regs->PAR[i]); dev->dev_addr[i] = readb(&regs->PAR[i]);
velocity_get_options(&vptr->options, velocity_nics - 1, dev->name); velocity_get_options(&vptr->options, velocity_nics, dev->name);
/* /*
* Mask out the options cannot be set to the chip * Mask out the options cannot be set to the chip
...@@ -817,6 +819,7 @@ static int __devinit velocity_found1(struct pci_dev *pdev, const struct pci_devi ...@@ -817,6 +819,7 @@ static int __devinit velocity_found1(struct pci_dev *pdev, const struct pci_devi
spin_unlock_irqrestore(&velocity_dev_list_lock, flags); spin_unlock_irqrestore(&velocity_dev_list_lock, flags);
} }
#endif #endif
velocity_nics++;
out: out:
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment