diff options
author | Marc Balmer <mbalmer@cvs.openbsd.org> | 2006-12-23 08:29:40 +0000 |
---|---|---|
committer | Marc Balmer <mbalmer@cvs.openbsd.org> | 2006-12-23 08:29:40 +0000 |
commit | cb435f1a82e36a4fc850de087d98a1d222b37756 (patch) | |
tree | 935f7ab950af95fcc5633d304431553a4760e5ce /sys/kern/tty_nmea.c | |
parent | ff2a46263c874f9322d9c4b5a8ada22fa14a0591 (diff) |
in nmeaopen(), only add the sensors to the system if there was no error.
Diffstat (limited to 'sys/kern/tty_nmea.c')
-rw-r--r-- | sys/kern/tty_nmea.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/kern/tty_nmea.c b/sys/kern/tty_nmea.c index 4ecac849707..4e965bd964a 100644 --- a/sys/kern/tty_nmea.c +++ b/sys/kern/tty_nmea.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty_nmea.c,v 1.14 2006/12/15 16:49:39 mbalmer Exp $ */ +/* $OpenBSD: tty_nmea.c,v 1.15 2006/12/23 08:29:39 mbalmer Exp $ */ /* * Copyright (c) 2006 Marc Balmer <mbalmer@openbsd.org> @@ -91,7 +91,6 @@ nmeaopen(dev_t dev, struct tty *tp) np->time.status = SENSOR_S_UNKNOWN; np->time.type = SENSOR_TIMEDELTA; np->time.flags = SENSOR_FINVALID; - sensor_add(&np->time); #ifdef NMEA_DEBUG snprintf(np->skew.device, sizeof(np->skew.device), "skew%d", nmea_count - 1); @@ -100,7 +99,6 @@ nmeaopen(dev_t dev, struct tty *tp) np->skew.status = SENSOR_S_UNKNOWN; np->skew.type = SENSOR_TIMEDELTA; np->skew.flags = SENSOR_FINVALID; - sensor_add(&np->skew); #endif np->sync = 1; tp->t_sc = (caddr_t)np; @@ -109,6 +107,11 @@ nmeaopen(dev_t dev, struct tty *tp) if (error) { free(np, M_DEVBUF); tp->t_sc = NULL; + } else { + sensor_add(&np->time); +#ifdef NMEA_DEBUG + sensor_add(&np->skew); +#endif } return (error); } |