diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2006-12-23 17:37:00 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2006-12-23 17:37:00 +0000 |
commit | 334be6991e21a4e3dadc2722eafb494a8043a050 (patch) | |
tree | 543202ba3fae988f43d8d35be969095604e90c62 /sys | |
parent | d99a3bec8bcb064fbf7efc8e8c099158ff08d196 (diff) |
if errors happen while reading the sdr list, give up on handling the
device as cleanly as possible. ok marco
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/ipmi.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/sys/dev/ipmi.c b/sys/dev/ipmi.c index 8590a1f5b98..1727acd1d58 100644 --- a/sys/dev/ipmi.c +++ b/sys/dev/ipmi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ipmi.c,v 1.50 2006/12/23 00:36:24 deraadt Exp $ */ +/* $OpenBSD: ipmi.c,v 1.51 2006/12/23 17:36:59 deraadt Exp $ */ /* * Copyright (c) 2005 Jordan Hargrave @@ -1683,6 +1683,18 @@ ipmi_attach(struct device *parent, struct device *self, void *aux) struct ipmi_attach_args *ia = aux; u_int16_t rec; + /* Map registers */ + ipmi_map_regs(sc, ia); + + /* Scan SDRs, add sensors */ + for (rec = 0; rec != 0xFFFF;) { + if (get_sdr(sc, rec, &rec)) { + /* IPMI may have been advertised, but it is stillborn */ + ipmi_unmap_regs(sc, ia); + return; + } + } + sc->sc_thread = malloc(sizeof(struct ipmi_thread), M_DEVBUF, M_NOWAIT|M_CANFAIL); if (sc->sc_thread == NULL) { @@ -1692,14 +1704,6 @@ ipmi_attach(struct device *parent, struct device *self, void *aux) sc->sc_thread->sc = sc; sc->sc_thread->running = 1; - /* Map registers */ - ipmi_map_regs(sc, ia); - - /* Scan SDRs, add sensors */ - for (rec = 0; rec != 0xFFFF;) - if (get_sdr(sc, rec, &rec)) - break; - /* initialize sensor list for thread */ if (!SLIST_EMPTY(&ipmi_sensor_list)) sc->current_sensor = SLIST_FIRST(&ipmi_sensor_list); |