Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 494
b: refs/heads/master
c: e8108c9
h: refs/heads/master
v: v3
  • Loading branch information
Marcelo Tosatti authored and Linus Torvalds committed Apr 26, 2005
1 parent fa079fe commit e36e839
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: efa545791ff439d778f79d02255d59ff1f7ea0fc
refs/heads/master: e8108c98dd6d65613fa0ec9d2300f89c48d554bf
22 changes: 12 additions & 10 deletions trunk/drivers/net/wan/pc300_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -3427,7 +3427,7 @@ cpc_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
{
static int first_time = 1;
ucchar cpc_rev_id;
int err = 0, eeprom_outdated = 0;
int err, eeprom_outdated = 0;
ucshort device_id;
pc300_t *card;

Expand All @@ -3439,15 +3439,21 @@ cpc_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
#endif
}

if ((err = pci_enable_device(pdev)) < 0)
return err;

card = (pc300_t *) kmalloc(sizeof(pc300_t), GFP_KERNEL);
if (card == NULL) {
printk("PC300 found at RAM 0x%08lx, "
"but could not allocate card structure.\n",
pci_resource_start(pdev, 3));
return -ENOMEM;
err = -ENOMEM;
goto err_disable_dev;
}
memset(card, 0, sizeof(pc300_t));

err = -ENODEV;

/* read PCI configuration area */
device_id = ent->device;
card->hw.irq = pdev->irq;
Expand Down Expand Up @@ -3507,29 +3513,23 @@ cpc_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
printk("PC300 found at RAM 0x%08x, "
"but could not allocate PLX mem region.\n",
card->hw.ramphys);
err = -ENODEV;
goto err_release_io;
}
if (!request_mem_region(card->hw.ramphys, card->hw.alloc_ramsize,
"On-board RAM")) {
printk("PC300 found at RAM 0x%08x, "
"but could not allocate RAM mem region.\n",
card->hw.ramphys);
err = -ENODEV;
goto err_release_plx;
}
if (!request_mem_region(card->hw.scaphys, card->hw.scasize,
"SCA-II Registers")) {
printk("PC300 found at RAM 0x%08x, "
"but could not allocate SCA mem region.\n",
card->hw.ramphys);
err = -ENODEV;
goto err_release_ram;
}

if ((err = pci_enable_device(pdev)) != 0)
goto err_release_sca;

card->hw.plxbase = ioremap(card->hw.plxphys, card->hw.plxsize);
card->hw.rambase = ioremap(card->hw.ramphys, card->hw.alloc_ramsize);
card->hw.scabase = ioremap(card->hw.scaphys, card->hw.scasize);
Expand Down Expand Up @@ -3619,7 +3619,6 @@ cpc_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
iounmap(card->hw.falcbase);
release_mem_region(card->hw.falcphys, card->hw.falcsize);
}
err_release_sca:
release_mem_region(card->hw.scaphys, card->hw.scasize);
err_release_ram:
release_mem_region(card->hw.ramphys, card->hw.alloc_ramsize);
Expand All @@ -3628,7 +3627,9 @@ cpc_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
err_release_io:
release_region(card->hw.iophys, card->hw.iosize);
kfree(card);
return -ENODEV;
err_disable_dev:
pci_disable_device(pdev);
return err;
}

static void __devexit cpc_remove_one(struct pci_dev *pdev)
Expand Down Expand Up @@ -3662,6 +3663,7 @@ static void __devexit cpc_remove_one(struct pci_dev *pdev)
if (card->hw.irq)
free_irq(card->hw.irq, card);
kfree(card);
pci_disable_device(pdev);
}
}

Expand Down

0 comments on commit e36e839

Please sign in to comment.