Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 93590
b: refs/heads/master
c: eb7a07e
h: refs/heads/master
v: v3
  • Loading branch information
Bartlomiej Zolnierkiewicz committed Apr 26, 2008
1 parent f73e233 commit f834e6b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 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: 79472b6ea9e74ee4400ba57ba84cad86426e2d6d
refs/heads/master: eb7a07e8d6580ea498cac53acafe42c080af4d06
24 changes: 18 additions & 6 deletions trunk/drivers/ide/pci/it821x.c
Original file line number Diff line number Diff line change
Expand Up @@ -523,16 +523,12 @@ static void __devinit it821x_quirkproc(ide_drive_t *drive)
static void __devinit init_hwif_it821x(ide_hwif_t *hwif)
{
struct pci_dev *dev = to_pci_dev(hwif->dev);
struct it821x_dev *idev = kzalloc(sizeof(struct it821x_dev), GFP_KERNEL);
struct it821x_dev **itdevs = (struct it821x_dev **)pci_get_drvdata(dev);
struct it821x_dev *idev = itdevs[hwif->channel];
u8 conf;

hwif->quirkproc = &it821x_quirkproc;

if (idev == NULL) {
printk(KERN_ERR "it821x: out of memory, falling back to legacy behaviour.\n");
return;
}

ide_set_hwifdata(hwif, idev);

pci_read_config_byte(dev, 0x50, &conf);
Expand Down Expand Up @@ -641,6 +637,22 @@ static const struct ide_port_info it821x_chipsets[] __devinitdata = {

static int __devinit it821x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
{
struct it821x_dev *itdevs[2] = { NULL, NULL} , *itdev;
unsigned int i;

for (i = 0; i < 2; i++) {
itdev = kzalloc(sizeof(*itdev), GFP_KERNEL);
if (itdev == NULL) {
kfree(itdevs[0]);
printk(KERN_ERR "it821x: out of memory\n");
return -ENOMEM;
}

itdevs[i] = itdev;
}

pci_set_drvdata(dev, itdevs);

return ide_setup_pci_device(dev, &it821x_chipsets[id->driver_data]);
}

Expand Down

0 comments on commit f834e6b

Please sign in to comment.