Module Name: src Committed By: jruoho Date: Sat Apr 3 17:54:25 UTC 2010
Modified Files: src/sys/dev/pci: arcmsr.c Log Message: Only unregister the sensors if these were successfully installed; sysmon_envsys_unregister() does not check for NULL pointers gracefully. To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/sys/dev/pci/arcmsr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/pci/arcmsr.c diff -u src/sys/dev/pci/arcmsr.c:1.24 src/sys/dev/pci/arcmsr.c:1.25 --- src/sys/dev/pci/arcmsr.c:1.24 Sat Apr 3 14:19:17 2010 +++ src/sys/dev/pci/arcmsr.c Sat Apr 3 17:54:24 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: arcmsr.c,v 1.24 2010/04/03 14:19:17 pgoyette Exp $ */ +/* $NetBSD: arcmsr.c,v 1.25 2010/04/03 17:54:24 jruoho Exp $ */ /* $OpenBSD: arc.c,v 1.68 2007/10/27 03:28:27 dlg Exp $ */ /* @@ -21,7 +21,7 @@ #include "bio.h" #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: arcmsr.c,v 1.24 2010/04/03 14:19:17 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: arcmsr.c,v 1.25 2010/04/03 17:54:24 jruoho Exp $"); #include <sys/param.h> #include <sys/buf.h> @@ -238,7 +238,9 @@ if (arc_msg0(sc, ARC_REG_INB_MSG0_FLUSH_CACHE) != 0) aprint_error_dev(self, "timeout waiting to flush cache\n"); - sysmon_envsys_unregister(sc->sc_sme); + if (sc->sc_sme != NULL) + sysmon_envsys_unregister(sc->sc_sme); + return 0; } @@ -1805,8 +1807,12 @@ kthread_exit(0); bad: - kmem_free(sc->sc_sensors, slen); sysmon_envsys_destroy(sc->sc_sme); + kmem_free(sc->sc_sensors, slen); + + sc->sc_sme = NULL; + sc->sc_sensors = NULL; + kthread_exit(0); }