Tell the user when the setup of the interrupt handler failed and return

an error.

Found by:	Coverity Prevent (tm)
CID:		71-78
This commit is contained in:
Alexander Leidinger 2007-04-01 16:52:54 +00:00
parent 4850546f51
commit 68af68014e
7 changed files with 61 additions and 23 deletions

View File

@ -515,8 +515,14 @@ avm_pnp_attach(device_t dev)
/* not needed */
sc->sc_irq = rman_get_start(sc->sc_resources.irq);
bus_setup_intr(dev,sc->sc_resources.irq,INTR_TYPE_NET,
error = bus_setup_intr(dev,sc->sc_resources.irq,INTR_TYPE_NET,
NULL, (void(*)(void*))avm_pnp_intr, sc,&ih);
if (error != 0)
{
printf("avm_pnp%d: Could not setup irq.\n",unit);
error = ENXIO;
goto fail;
}
sc->sc_unit = unit;
/* end of new-bus stuff */

View File

@ -206,8 +206,15 @@ ihfc_pnp_probe(device_t dev)
/* setup interrupt routine now to avvoid stray *
* interrupts. */
bus_setup_intr(dev, S_IRQ, INTR_TYPE_NET, NULL, (void(*)(void*))
HFC_INTR, sc, &dummy);
if (bus_setup_intr(dev, S_IRQ, INTR_TYPE_NET,
NULL, (void(*)(void*)) HFC_INTR, sc,
&dummy) != 0)
{
printf("ihfc%d: failed to setup irq.\n",
unit);
HFC_END;
return ENXIO;
}
flag = 1;
@ -298,8 +305,13 @@ ihfc_isa_probe(device_t dev)
/* setup interrupt routine now to avvoid stray *
* interrupts. */
bus_setup_intr(dev, S_IRQ, INTR_TYPE_NET, NULL, (void(*)(void*))
HFC_INTR, sc, &dummy);
if (bus_setup_intr(dev, S_IRQ, INTR_TYPE_NET, NULL,
(void(*)(void*)) HFC_INTR, sc, &dummy) != 0)
{
printf("ihfc%d: failed to setup irq.\n", unit);
HFC_END;
return ENXIO;
}
flag = 1;

View File

@ -252,9 +252,13 @@ isic_probe_avma1(device_t dev)
sc->sc_irq = rman_get_start(sc->sc_resources.irq);
/* register interupt routine */
bus_setup_intr(dev, sc->sc_resources.irq, INTR_TYPE_NET,
NULL, (void(*)(void *))(isicintr),
sc, &ih);
if (bus_setup_intr(dev, sc->sc_resources.irq, INTR_TYPE_NET, NULL,
(void(*)(void *))(isicintr), sc, &ih) != 0)
{
printf("isic%d: Could not setup the irq for AVM A1/Fritz!\n",unit);
isic_detach_common(dev);
return ENXIO;
}
/* check IRQ validity */

View File

@ -320,9 +320,14 @@ isic_pnp_attach(device_t dev)
else
{
/* setup intr routine */
bus_setup_intr(dev,sc->sc_resources.irq,INTR_TYPE_NET,
NULL, (void(*)(void*))isicintr,
sc,&ih);
if (bus_setup_intr(dev,sc->sc_resources.irq,INTR_TYPE_NET,
NULL, (void(*)(void*))isicintr, sc,&ih) != 0)
{
printf("isic%d: Could not setup irq.\n",unit);
isic_detach_common(dev);
return ENXIO;
}
return 0;
}
}

View File

@ -279,10 +279,15 @@ isic_probe_itkix1(device_t dev)
printf("Setting up access interupt...");
#endif
bus_setup_intr(dev, sc->sc_resources.irq,
INTR_TYPE_NET,
NULL, (void(*)(void *))(isicintr),
sc, &ih);
if (bus_setup_intr(dev, sc->sc_resources.irq, INTR_TYPE_NET, NULL,
(void(*)(void *))(isicintr), sc, &ih) != 0)
{
printf("isic%d: Could not setup irq for ITK IX1.\n", unit);
bus_release_resource(dev,SYS_RES_IOPORT,
sc->sc_resources.io_rid[0],
sc->sc_resources.io_base[0]);
return ENXIO;
}
#if defined(ITK_PROBE_DEBUG)
printf("done.\n");

View File

@ -302,10 +302,13 @@ isic_probe_s016(device_t dev)
/* register interupt routine */
bus_setup_intr(dev, sc->sc_resources.irq,
INTR_TYPE_NET,
NULL, (void(*)(void *))(isicintr),
sc, &ih);
if (bus_setup_intr(dev, sc->sc_resources.irq, INTR_TYPE_NET, NULL,
(void(*)(void *))(isicintr), sc, &ih) != 0)
{
printf("isic%d: Could not setup irq for Teles S0/16.\n", unit);
isic_detach_common(dev);
return ENXIO;
}
/* get the irq number */

View File

@ -339,10 +339,13 @@ isic_probe_s0163(device_t dev)
}
/* register interupt routine */
bus_setup_intr(dev, sc->sc_resources.irq,
INTR_TYPE_NET,
NULL, (void(*)(void *))(isicintr),
sc, &ih);
if (bus_setup_intr(dev, sc->sc_resources.irq, INTR_TYPE_NET, NULL,
(void(*)(void *))(isicintr), sc, &ih) != 0)
{
printf("isic%d: Could not setup IRQ for Teles S0/16.3.\n",unit);
isic_detach_common(dev);
return ENXIO;
}
return (0);
}