From 92e2cbac29020f146ac1437a3d37f925019f6c54 Mon Sep 17 00:00:00 2001 From: martin Date: Mon, 27 Apr 2015 11:55:29 +0000 Subject: [PATCH] Print error codes from sysmon --- sys/arch/sparc64/dev/lom.c | 11 ++++++----- sys/arch/sparc64/dev/tda.c | 24 ++++++++++++++---------- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/sys/arch/sparc64/dev/lom.c b/sys/arch/sparc64/dev/lom.c index 4473ccf48568..331ef5a83e62 100644 --- a/sys/arch/sparc64/dev/lom.c +++ b/sys/arch/sparc64/dev/lom.c @@ -1,4 +1,4 @@ -/* $NetBSD: lom.c,v 1.14 2015/02/21 07:40:01 nakayama Exp $ */ +/* $NetBSD: lom.c,v 1.15 2015/04/27 11:55:29 martin Exp $ */ /* $OpenBSD: lom.c,v 1.21 2010/02/28 20:44:39 kettenis Exp $ */ /* * Copyright (c) 2009 Mark Kettenis @@ -17,7 +17,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: lom.c,v 1.14 2015/02/21 07:40:01 nakayama Exp $"); +__KERNEL_RCSID(0, "$NetBSD: lom.c,v 1.15 2015/04/27 11:55:29 martin Exp $"); #include #include @@ -265,7 +265,7 @@ lom_attach(device_t parent, device_t self, void *aux) struct ebus_attach_args *ea = aux; uint8_t reg, fw_rev, config, config2, config3; uint8_t cal, low; - int i; + int i, err; const struct sysctlnode *node = NULL, *newnode; if (strcmp(ea->ea_name, "SUNW,lomh") == 0) { @@ -415,9 +415,10 @@ lom_attach(device_t parent, device_t self, void *aux) sc->sc_sme->sme_name = device_xname(self); sc->sc_sme->sme_cookie = sc; sc->sc_sme->sme_refresh = lom_refresh; - if (sysmon_envsys_register(sc->sc_sme)) { + err = sysmon_envsys_register(sc->sc_sme); + if (err) { aprint_error_dev(self, - "unable to register envsys with sysmon\n"); + "unable to register envsys with sysmon, error %d\n", err); sysmon_envsys_destroy(sc->sc_sme); return; } diff --git a/sys/arch/sparc64/dev/tda.c b/sys/arch/sparc64/dev/tda.c index 42dc39386414..1e09ab0cb880 100644 --- a/sys/arch/sparc64/dev/tda.c +++ b/sys/arch/sparc64/dev/tda.c @@ -1,4 +1,4 @@ -/* $NetBSD: tda.c,v 1.9 2013/10/26 18:49:30 jdc Exp $ */ +/* $NetBSD: tda.c,v 1.10 2015/04/27 11:55:29 martin Exp $ */ /* $OpenBSD: tda.c,v 1.4 2008/02/27 17:25:00 robert Exp $ */ /* @@ -19,7 +19,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tda.c,v 1.9 2013/10/26 18:49:30 jdc Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tda.c,v 1.10 2015/04/27 11:55:29 martin Exp $"); #include #include @@ -108,6 +108,7 @@ tda_attach(device_t parent, device_t self, void *aux) { struct tda_softc *sc = device_private(self); struct i2c_attach_args *ia = aux; + int rc; sc->sc_dev = self; sc->sc_tag = ia->ia_tag; @@ -138,26 +139,29 @@ tda_attach(device_t parent, device_t self, void *aux) strlcpy(sc->sc_sensor[SENSOR_FAN_SYS].desc, "fan.sys",sizeof("fan.sys")); sc->sc_sme = sysmon_envsys_create(); - if (sysmon_envsys_sensor_attach( - sc->sc_sme, &sc->sc_sensor[SENSOR_FAN_CPU])) { + rc = sysmon_envsys_sensor_attach( + sc->sc_sme, &sc->sc_sensor[SENSOR_FAN_CPU]); + if (rc) { sysmon_envsys_destroy(sc->sc_sme); aprint_error_dev(self, - "unable to attach cpu fan at sysmon\n"); + "unable to attach cpu fan at sysmon, error %d\n", rc); return; } - if (sysmon_envsys_sensor_attach( - sc->sc_sme, &sc->sc_sensor[SENSOR_FAN_SYS])) { + rc = sysmon_envsys_sensor_attach( + sc->sc_sme, &sc->sc_sensor[SENSOR_FAN_SYS]); + if (rc) { sysmon_envsys_destroy(sc->sc_sme); aprint_error_dev(self, - "unable to attach sys fan at sysmon\n"); + "unable to attach sys fan at sysmon, error %d\n", rc); return; } sc->sc_sme->sme_name = device_xname(self); sc->sc_sme->sme_cookie = sc; sc->sc_sme->sme_refresh = tda_refresh; - if (sysmon_envsys_register(sc->sc_sme)) { + rc = sysmon_envsys_register(sc->sc_sme); + if (rc) { aprint_error_dev(self, - "unable to register with sysmon\n"); + "unable to register with sysmon, error %d\n", rc); sysmon_envsys_destroy(sc->sc_sme); return; }