Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/pcmcia Avoid splx() with uninitialized priority leve...
details: https://anonhg.NetBSD.org/src/rev/07cee8182484
branches: trunk
changeset: 554467:07cee8182484
user: pooka <pooka%NetBSD.org@localhost>
date: Tue Oct 28 17:35:30 2003 +0000
description:
Avoid splx() with uninitialized priority level by duplicating some code
to get rid of gotos.
While doing that, add more verbosity on what failed if attach is not succesful.
diffstat:
sys/dev/pcmcia/isic_pcmcia.c | 33 ++++++++++++++++++++-------------
1 files changed, 20 insertions(+), 13 deletions(-)
diffs (70 lines):
diff -r ce3bf20d7a96 -r 07cee8182484 sys/dev/pcmcia/isic_pcmcia.c
--- a/sys/dev/pcmcia/isic_pcmcia.c Tue Oct 28 17:18:37 2003 +0000
+++ b/sys/dev/pcmcia/isic_pcmcia.c Tue Oct 28 17:35:30 2003 +0000
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: isic_pcmcia.c,v 1.20 2003/10/03 16:38:44 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isic_pcmcia.c,v 1.21 2003/10/28 17:35:30 pooka Exp $");
#include <sys/param.h>
#include <sys/errno.h>
@@ -213,15 +213,22 @@
/* Which card is it? */
cde = find_matching_card(pa);
- if (cde == NULL)
- goto bad2; /* oops - not found?!? */
+ if (cde == NULL) {
+ printf("%s: attach failed, couldn't find matching card\n",
+ psc->sc_isic.sc_dev.dv_xname);
+ return;
+ }
/* Enable the card */
pcmcia_function_init(pa->pf, cfe);
pcmcia_function_enable(pa->pf);
- if (!cde->attach(psc, cfe, pa))
- goto bad; /* Ooops ? */
+ if (!cde->attach(psc, cfe, pa)) {
+ pcmcia_function_disable(psc->sc_pf);
+ printf("%s: attach failed, card-specific attach unsuccesful\n",
+ psc->sc_isic.sc_dev.dv_xname);
+ return;
+ }
/* Announce card name */
printf(": %s\n", cde->name);
@@ -229,22 +236,22 @@
/* XXX - we generate interrupts during card initialization.
Block them for now, until the handler is established. */
s = splhigh();
-
+
/* MI initilization */
sc->sc_cardtyp = cde->card_type;
if (isic_pcmcia_isdn_attach(sc, cde->name) == 0) {
/* setup interrupt */
psc->sc_ih = pcmcia_intr_establish(pa->pf, IPL_NET, isicintr, sc);
- } else
- goto bad;
+ } else {
+ pcmcia_function_disable(psc->sc_pf);
+ splx(s);
+ printf("%s: attach failed, couldn't establish interrupt\n",
+ psc->sc_isic.sc_dev.dv_xname);
+ return;
+ }
splx(s);
return;
-bad:
- pcmcia_function_disable(psc->sc_pf);
- splx(s);
-bad2:
- printf("%s: attach failed\n", psc->sc_isic.sc_dev.dv_xname);
}
static int
Home |
Main Index |
Thread Index |
Old Index