diff options
author | Marco Peereboom <marco@cvs.openbsd.org> | 2005-12-13 04:00:19 +0000 |
---|---|---|
committer | Marco Peereboom <marco@cvs.openbsd.org> | 2005-12-13 04:00:19 +0000 |
commit | eb88098ba0971e114c82c1b180c286c4d055cd37 (patch) | |
tree | 5ea48f1af405e48f8b2c47fc4ad762b060faf39f /sys/dev/ipmi.c | |
parent | 51ad6938493c844ac037a3b269772c56f0c368f5 (diff) |
Add check for return value in recvcmd.
Unmap ipmi registers if attach fails.
ok jordan@
Diffstat (limited to 'sys/dev/ipmi.c')
-rw-r--r-- | sys/dev/ipmi.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/dev/ipmi.c b/sys/dev/ipmi.c index 449cc1062e5..beabebba825 100644 --- a/sys/dev/ipmi.c +++ b/sys/dev/ipmi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ipmi.c,v 1.23 2005/12/13 03:49:32 deraadt Exp $ */ +/* $OpenBSD: ipmi.c,v 1.24 2005/12/13 04:00:18 marco Exp $ */ /* * Copyright (c) 2005 Jordan Hargrave @@ -1028,7 +1028,8 @@ ipmi_recvcmd(struct ipmi_softc *sc, int maxlen, int *rxlen, void *data) return -1; } /* Receive message from interface, copy out result data */ - sc->sc_if->recvmsg(sc, maxlen + 3, &rawlen, buf); + if (sc->sc_if->recvmsg(sc, maxlen + 3, &rawlen, buf)) + return (-1); *rxlen = rawlen - IPMI_MSG_DATARCV; if (*rxlen > 0 && data) @@ -1643,10 +1644,12 @@ ipmi_attach(struct device *parent, struct device *self, void *aux) /* Identify BMC device */ if (ipmi_sendcmd(sc, BMC_SA, 0, APP_NETFN, APP_GET_DEVICE_ID, 0, NULL)){ printf(": unable to send get device id command\n"); + ipmi_unmap_regs(sc, ia); return; } if (ipmi_recvcmd(sc, sizeof(cmd), &len, cmd)) { printf(": unable to retrieve device id\n"); + ipmi_unmap_regs(sc, ia); return; } dbg_dump(1, "bmc data", len, cmd); |