Hi All,
I modified the g++ extension we were using to check malloc/free to
also check irq alloc/dealloc (since its very similar). It has two
rules:
1. all request_irq's are checked for failure.
2. on error paths all allocated irq's are deallocated.
It turned up a bunch of cases in device drivers, some of which look
like actual errors. If anyone could look at these and say whether such
errors are (1) important and (2) actual (rather than false positives)
I'd appreciate it.
Dawson
----------------------------------------------------------------------
/u2/engler/ic/linux-2.3.99/drivers/char/pc_keyb.c:754:pckbd_init_hw: ERROR: unchecked irq_alloc
void __init pckbd_init_hw(void){
kbd_request_region();
/* Flush any pending input. */
kbd_clear_input();
if (kbd_startup_reset) {
char *msg = initialize_kbd();
if (msg)
printk(KERN_WARNING "initialize_kbd: %s\n", msg); }#if defined CONFIG_PSMOUSE
psaux_init();
#endif
/* Ok, finally allocate the IRQ, and off we go.. */
kbd_request_irq(keyboard_interrupt); <------ unchecked
}
--------------------------------------------------------------------------
/u2/engler/ic/linux-2.3.99/drivers/char/stradis.c:2076:configure_saa7146: ERROR:did not deallocate irq from line 2065
result = request_irq (saa->irq, saa7146_irq, SA_SHIRQ | SA_INTERRUPT, "stradis", (void *) saa);
if (result == -EINVAL)
printk (KERN_ERR "stradis%d: Bad irq number or handler\n", num);
if (result == -EBUSY)
printk (KERN_ERR "stradis%d: IRQ %ld busy, change your PnP"
" config in BIOS\n", num, saa->irq);
if (result < 0)
return result;
pci_set_master (dev);
if (video_register_device (&saa->video_dev, VFL_TYPE_GRABBER) < 0)
return -1; <----------------- lost irq
----------------------------------------------------------------------------
/u2/engler/ic/linux-2.3.99/drivers/net/tokenring/abyss.c:195:abyss_probe: ERROR:did not deallocate irq from line 131
/u2/engler/ic/linux-2.3.99/drivers/net/tokenring/abyss.c:201:abyss_probe: ERROR:did not deallocate irq from line 131
request_region(pci_ioaddr, ABYSS_IO_EXTENT, "abyss");
if(request_irq(pdev->irq, tms380tr_interrupt, SA_SHIRQ,
"abyss", dev)) {
release_region(pci_ioaddr, ABYSS_IO_EXTENT) ;
continue; /*return (-ENODEV);*/ /* continue; ?? */
}
card->pci_dev = pdev;
} else {
printk("abyss: register_trdev() returned non-zero.\n");
kfree(dev->priv);
kfree(dev);
return -1;
...
if (abyss_card_list)
return 0;
return (-1);
}
-----------------------------------------------------------------------
Aren't totally clear cut since alot happens in between:
if (request_irq(dev->irq, &streamer_interrupt, SA_SHIRQ, "streamer", dev)) {
return -EAGAIN;
}
...
/u2/engler/ic/linux-2.3.99/drivers/net/tokenring/lanstreamer.c:566:streamer_open: ERROR:did not deallocate irq from line 464
if (srb_word == STREAMER_CLEAR_RET_CODE) {
printk(KERN_WARNING "%s: Adapter Open time out or error.\n",
dev->name);
return -EIO;
}
ERNEL);
/u2/engler/ic/linux-2.3.99/drivers/net/tokenring/lanstreamer.c:645:streamer_open: ERROR:did not deallocate irq from line 464
if (!streamer_priv->streamer_rx_ring) {
printk(KERN_WARNING "%s ALLOC of streamer rx ring FAILED!!\n",dev->name);
return -EIO;
}
/u2/engler/ic/linux-2.3.99/drivers/net/tokenring/lanstreamer.c:686:streamer_open: ERROR:did not deallocate irq from line 464
if (!streamer_priv->streamer_tx_ring) {
printk(KERN_WARNING "%s ALLOC of streamer_tx_ring FAILED\n",dev->name);
return -EIO;
}
--------------------------------------------------------------------
/u2/engler/ic/linux-2.3.99/drivers/net/tokenring/smctr.c:1170:smctr_chk_isa: ERROR:did not deallocate irq from line 1093
if(request_irq(dev->irq, smctr_interrupt, SA_SHIRQ, smctr_name, dev)) return (-ENODEV);
...
/* see if the chip is corrupted */
if(smctr_read_584_chksum(ioaddr))
{
printk("%s: EEPROM Checksum Failure\n", dev->name);
return(-1);
}
--------------------------------------------------------------------
/u2/engler/ic/linux-2.3.99/drivers/net/tokenring/tmspci.c:221:tms_pci_probe: ERROR:did not deallocate irq from line 154
/u2/engler/ic/linux-2.3.99/drivers/net/tokenring/tmspci.c:227:tms_pci_probe: ERROR:did not deallocate irq from line 154
if(request_irq(pdev->irq, tms380tr_interrupt, SA_SHIRQ,
cardinfo->name, dev)) {
release_region(pci_ioaddr, TMS_PCI_IO_EXTENT);
continue; /*return (-ENODEV);*/ /* continue; ?? */
}
card->pci_dev = pdev;
card->cardinfo = cardinfo;
} else {
printk("%s: register_trdev() returned non-zero.\n", dev->name);
kfree(dev->priv);
kfree(dev);
return -1;
}
}
if (tms_pci_card_list)
return 0;
return (-1);
}
--------------------------------------------------------------------------
/u2/engler/ic/linux-2.3.99/drivers/net/appletalk/ltpc.c:1226:ltpc_probe: ERROR: unchecked irq_alloc
if (irq) {
/* grab it and don't let go :-) */
(void) request_irq( irq, <pc_interrupt, 0, "ltpc", dev);
-----------------------------------------------------------------------
/u2/engler/ic/linux-2.3.99/drivers/pcmcia/i82365.c:1511:init_i82365: ERROR: unchecked irq_alloc
/* Set up interrupt handler(s) */
#ifdef CONFIG_ISA
if (grab_irq != 0)
request_irq(cs_irq, pcic_interrupt, 0, "i82365", pcic_interrupt);
#endif
------------------------
/u2/engler/ic/linux-2.3.99/drivers/isdn/sc/init.c:383:init_sc: ERROR: unchecked irq_alloc
REQUEST_IRQ(adapter[cinst]->interrupt, interrupt_handler, SA_INTERRUPT,
interface->id, NULL);
-------------------------------------------------------------------
/u2/engler/ic/linux-2.3.99/drivers/atm/zatm.c:1514:zatm_start: ERROR:did not deallocate irq from line 1467
/u2/engler/ic/linux-2.3.99/drivers/atm/zatm.c:1506:zatm_start: ERROR:did not deallocate irq from line 1467
if (request_irq(zatm_dev->irq,&zatm_int,SA_SHIRQ,DEV_LABEL,dev)) { printk(KERN_ERR DEV_LABEL "(itf %d): IRQ%d is already in use\n",
dev->number,zatm_dev->irq); return -EAGAIN;
...
if ((here^virt_to_bus((void *) here)) & 0xffff) { printk(KERN_ERR DEV_LABEL "(itf %d): system "
"bus incompatible with driver\n",
dev->number); kfree((void *) here);
return -ENODEV;
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Tue Aug 15 2000 - 21:00:26 EST