1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-11-24 10:42:49 +02:00

[adm5120] fix switch_driver to avoid segfaults

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@8071 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
juhosg 2007-07-20 09:07:18 +00:00
parent 547672a7cb
commit 48b7bf6e3d

View File

@ -554,7 +554,7 @@ static int __init adm5120_sw_init(void)
adm5120_set_reg(ADM5120_RECEIVE_HBADDR, KSEG1ADDR(adm5120_dma_rxh)); adm5120_set_reg(ADM5120_RECEIVE_HBADDR, KSEG1ADDR(adm5120_dma_rxh));
adm5120_set_reg(ADM5120_RECEIVE_LBADDR, KSEG1ADDR(adm5120_dma_rxl)); adm5120_set_reg(ADM5120_RECEIVE_LBADDR, KSEG1ADDR(adm5120_dma_rxl));
for (i=0; i<adm5120_nrdevs; i++) { for (i = 0; i < SW_DEVS; i++) {
adm5120_devs[i] = alloc_etherdev(sizeof(struct adm5120_sw)); adm5120_devs[i] = alloc_etherdev(sizeof(struct adm5120_sw));
if (!adm5120_devs[i]) { if (!adm5120_devs[i]) {
err = -ENOMEM; err = -ENOMEM;
@ -612,9 +612,9 @@ static void __exit adm5120_sw_exit(void)
{ {
int i; int i;
for (i = 0; i < adm5120_nrdevs; i++) { for (i = 0; i < SW_DEVS; i++) {
unregister_netdev(adm5120_devs[i]); unregister_netdev(adm5120_devs[i]);
free_netdev(adm5120_devs[i-1]); free_netdev(adm5120_devs[i]);
} }
free_irq(ADM5120_IRQ_SWITCH, NULL); free_irq(ADM5120_IRQ_SWITCH, NULL);