summaryrefslogtreecommitdiffstats
path: root/sys/dev
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2006-12-23 17:36:59 +0000
committerderaadt <deraadt@openbsd.org>2006-12-23 17:36:59 +0000
commit2b13db1666eda7049912f185eb95ea075723800c (patch)
tree6540e68e402d437b27250d60582ff95f29203f4d /sys/dev
parentAdd the ability to issue GPCMD_REPORT_KEY and GPCMD_SEND_KEY scsi (diff)
downloadwireguard-openbsd-2b13db1666eda7049912f185eb95ea075723800c.tar.xz
wireguard-openbsd-2b13db1666eda7049912f185eb95ea075723800c.zip
if errors happen while reading the sdr list, give up on handling the
device as cleanly as possible. ok marco
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ipmi.c22
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);