summaryrefslogtreecommitdiffstats
path: root/sys/i386/isa/psm.c
diff options
context:
space:
mode:
authornate <nate@FreeBSD.org>1997-01-16 18:57:19 +0000
committernate <nate@FreeBSD.org>1997-01-16 18:57:19 +0000
commit104d3c9ef67e45cdbb45100d6f7416ad9f6c75ba (patch)
treed66166d131518ec8c19c89a254f45e575bdbc751 /sys/i386/isa/psm.c
parenta1dd37c329b1306804a7b19a1aeda00f327738c0 (diff)
downloadFreeBSD-src-104d3c9ef67e45cdbb45100d6f7416ad9f6c75ba.zip
FreeBSD-src-104d3c9ef67e45cdbb45100d6f7416ad9f6c75ba.tar.gz
Bring back the fix from 1.32 that got spammed by recent changes.
Diffstat (limited to 'sys/i386/isa/psm.c')
-rw-r--r--sys/i386/isa/psm.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/sys/i386/isa/psm.c b/sys/i386/isa/psm.c
index f4da6f6..9aaed74 100644
--- a/sys/i386/isa/psm.c
+++ b/sys/i386/isa/psm.c
@@ -492,6 +492,8 @@ psmprobe(struct isa_device *dvp)
if (unit >= NPSM)
return (0);
+ psm_softc[unit] = NULL;
+
sc = malloc(sizeof *sc, M_DEVBUF, M_NOWAIT);
bzero(sc, sizeof *sc);
@@ -728,6 +730,9 @@ psmattach(struct isa_device *dvp)
int unit = dvp->id_unit;
struct psm_softc *sc = psm_softc[unit];
+ if (sc == NULL) /* shouldn't happen */
+ return (0);
+
/* initial operation mode */
sc->dflt_mode.accelfactor = sc->mode.accelfactor = PSM_ACCEL;
sc->dflt_mode.protocol = sc->mode.protocol = MOUSE_PROTO_PS2;
@@ -771,7 +776,7 @@ psmopen(dev_t dev, int flag, int fmt, struct proc *p)
/* Get device data */
sc = psm_softc[unit];
- if ((sc->state & PSM_VALID) == 0)
+ if ((sc == NULL) || (sc->state & PSM_VALID) == 0)
/* the device is no longer valid/functioning */
return (ENXIO);
OpenPOWER on IntegriCloud