Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/i2c Make sure sensor state is valid before calling s...



details:   https://anonhg.NetBSD.org/src/rev/685f54c00938
branches:  trunk
changeset: 766390:685f54c00938
user:      hannken <hannken%NetBSD.org@localhost>
date:      Tue Jun 21 12:38:27 2011 +0000

description:
Make sure sensor state is valid before calling sysmon_envsys_sensor_attach().

Ok: Paul Goyette <pgoyette%netbsd.org@localhost>

diffstat:

 sys/dev/i2c/ibmhawk.c |  11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diffs (32 lines):

diff -r 92065bc57327 -r 685f54c00938 sys/dev/i2c/ibmhawk.c
--- a/sys/dev/i2c/ibmhawk.c     Tue Jun 21 11:52:45 2011 +0000
+++ b/sys/dev/i2c/ibmhawk.c     Tue Jun 21 12:38:27 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ibmhawk.c,v 1.2 2011/02/14 14:15:25 hannken Exp $ */
+/* $NetBSD: ibmhawk.c,v 1.3 2011/06/21 12:38:27 hannken Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -313,9 +313,6 @@
                            ibmhawk_normalize(sd->ihs_warnmax, dp->units);
                        dp->flags |= ENVSYS_FMONLIMITS;
                }
-               if (sysmon_envsys_sensor_attach(sc->sc_sme, dp))
-                       aprint_error_dev(sc->sc_dev,
-                           "failed to attach \"%s\"\n", dp->desc);
        }
 
        if (valid) {
@@ -323,6 +320,12 @@
                dp->state = ENVSYS_SVALID;
        } else
                dp->state = ENVSYS_SINVALID;
+
+       if (create) {
+               if (sysmon_envsys_sensor_attach(sc->sc_sme, dp))
+                       aprint_error_dev(sc->sc_dev,
+                           "failed to attach \"%s\"\n", dp->desc);
+       }
 }
 
 static void



Home | Main Index | Thread Index | Old Index