Skip to content

Commit af640d1

Browse files
ArvindYadavCshdeller
authored andcommitted
parisc: eisa: Fix resource leaks in error paths
Signed-off-by: Arvind Yadav <[email protected]> Signed-off-by: Helge Deller <[email protected]>
1 parent 99cde44 commit af640d1

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

drivers/parisc/eisa.c

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ static int __init eisa_probe(struct parisc_device *dev)
334334
result = request_irq(dev->irq, eisa_irq, IRQF_SHARED, "EISA", &eisa_dev);
335335
if (result) {
336336
printk(KERN_ERR "EISA: request_irq failed!\n");
337-
return result;
337+
goto error_release;
338338
}
339339

340340
/* Reserve IRQ2 */
@@ -358,6 +358,11 @@ static int __init eisa_probe(struct parisc_device *dev)
358358
}
359359
}
360360
eisa_eeprom_addr = ioremap_nocache(eisa_dev.eeprom_addr, HPEE_MAX_LENGTH);
361+
if (!eisa_eeprom_addr) {
362+
result = -ENOMEM;
363+
printk(KERN_ERR "EISA: ioremap_nocache failed!\n");
364+
goto error_free_irq;
365+
}
361366
result = eisa_enumerator(eisa_dev.eeprom_addr, &eisa_dev.hba.io_space,
362367
&eisa_dev.hba.lmmio_space);
363368
init_eisa_pic();
@@ -372,11 +377,20 @@ static int __init eisa_probe(struct parisc_device *dev)
372377
eisa_dev.root.dma_mask = 0xffffffff; /* wild guess */
373378
if (eisa_root_register (&eisa_dev.root)) {
374379
printk(KERN_ERR "EISA: Failed to register EISA root\n");
375-
return -1;
380+
result = -ENOMEM;
381+
goto error_iounmap;
376382
}
377383
}
378384

379385
return 0;
386+
387+
error_iounmap:
388+
iounmap(eisa_eeprom_addr);
389+
error_free_irq:
390+
free_irq(dev->irq, &eisa_dev);
391+
error_release:
392+
release_resource(&eisa_dev.hba.io_space);
393+
return result;
380394
}
381395

382396
static const struct parisc_device_id eisa_tbl[] = {

0 commit comments

Comments
 (0)