Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/sysmon Instead of crashing, print a usable error mes...
details: https://anonhg.NetBSD.org/src/rev/00fe6dfc5036
branches: trunk
changeset: 766251:00fe6dfc5036
user: martin <martin%NetBSD.org@localhost>
date: Sun Jun 19 11:40:26 2011 +0000
description:
Instead of crashing, print a usable error message when a driver eroneously
does not properly initialize sensor state.
diffstat:
sys/dev/sysmon/sysmon_envsys.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diffs (30 lines):
diff -r 438fe5da34c3 -r 00fe6dfc5036 sys/dev/sysmon/sysmon_envsys.c
--- a/sys/dev/sysmon/sysmon_envsys.c Sun Jun 19 11:31:55 2011 +0000
+++ b/sys/dev/sysmon/sysmon_envsys.c Sun Jun 19 11:40:26 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sysmon_envsys.c,v 1.115 2011/06/15 13:34:13 pgoyette Exp $ */
+/* $NetBSD: sysmon_envsys.c,v 1.116 2011/06/19 11:40:26 martin Exp $ */
/*-
* Copyright (c) 2007, 2008 Juan Romero Pardines.
@@ -64,7 +64,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys.c,v 1.115 2011/06/15 13:34:13 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys.c,v 1.116 2011/06/19 11:40:26 martin Exp $");
#include <sys/param.h>
#include <sys/types.h>
@@ -1535,6 +1535,11 @@
int error = 0;
sdt = sme_find_table_entry(SME_DESC_STATES, edata->state);
+ if (sdt == NULL) {
+ printf("sme_update_sensor_dictionary: can not update sensor "
+ "state %d unknown\n", edata->state);
+ return EINVAL;
+ }
DPRINTFOBJ(("%s: sensor #%d type=%d (%s) flags=%d\n", __func__,
edata->sensor, sdt->type, sdt->desc, edata->flags));
Home |
Main Index |
Thread Index |
Old Index