Check pmf_device_register return value. NFC

Appeases static analyzers.
This commit is contained in:
maya 2017-01-20 12:25:07 +00:00
parent c8226a8b4f
commit b8f12c7fce
13 changed files with 49 additions and 32 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: vbox_drv.c,v 1.2 2011/08/28 17:18:31 jmcneill Exp $ */
/* $NetBSD: vbox_drv.c,v 1.3 2017/01/20 12:25:07 maya Exp $ */
/*
* Copyright (c) 2011 Jared D. McNeill <jmcneill@invisible.ca>
@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: vbox_drv.c,v 1.2 2011/08/28 17:18:31 jmcneill Exp $");
__KERNEL_RCSID(0, "$NetBSD: vbox_drv.c,v 1.3 2017/01/20 12:25:07 maya Exp $");
#include "drmP.h"
#include "drm.h"
@ -69,7 +69,8 @@ vboxdrm_attach(device_t parent, device_t self, void *opaque)
struct pci_attach_args *pa = opaque;
struct drm_device *dev = device_private(self);
pmf_device_register(self, NULL, NULL);
if (!pmf_device_register(self, NULL, NULL))
aprint_error_dev(self, "couldn't establish power handler\n");
dev->driver = kmem_zalloc(sizeof(struct drm_driver_info), KM_SLEEP);
if (dev->driver == NULL) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: gpiolock.c,v 1.3 2009/12/06 22:33:44 dyoung Exp $ */
/* $NetBSD: gpiolock.c,v 1.4 2017/01/20 12:25:07 maya Exp $ */
/*
* Copyright (c) 2009 Marc Balmer <marc@msys.ch>
@ -123,7 +123,8 @@ gpiolock_attach(device_t parent, device_t self, void *aux)
goto fail;
}
#endif
pmf_device_register(self, NULL, NULL);
if (!pmf_device_register(self, NULL, NULL))
aprint_error_dev(self, "couldn't establish power handler\n");
aprint_normal("\n");
return;

View File

@ -1,4 +1,4 @@
/* $NetBSD: gpiopwm.c,v 1.5 2016/07/14 04:00:45 msaitoh Exp $ */
/* $NetBSD: gpiopwm.c,v 1.6 2017/01/20 12:25:07 maya Exp $ */
/*
* Copyright (c) 2011 Marc Balmer <marc@msys.ch>
@ -104,7 +104,8 @@ gpiopwm_attach(device_t parent, device_t self, void *aux)
return;
}
aprint_normal(" [%d]", sc->sc_map.pm_map[0]);
pmf_device_register(self, NULL, NULL);
if (!pmf_device_register(self, NULL, NULL))
aprint_error_dev(self, "couldn't establish power handler\n");
callout_init(&sc->sc_pulse, CALLOUT_MPSAFE);
callout_setfunc(&sc->sc_pulse, gpiopwm_pulse, sc);

View File

@ -1,4 +1,4 @@
/* $NetBSD: gpiosim.c,v 1.19 2016/07/14 04:00:45 msaitoh Exp $ */
/* $NetBSD: gpiosim.c,v 1.20 2017/01/20 12:25:07 maya Exp $ */
/* $OpenBSD: gpiosim.c,v 1.1 2008/11/23 18:46:49 mbalmer Exp $ */
/*
@ -121,7 +121,8 @@ gpiosim_attach(device_t parent, device_t self, void *aux)
gba.gba_pins = sc->sc_gpio_pins;
gba.gba_npins = GPIOSIM_NPINS;
pmf_device_register(self, NULL, NULL);
if (!pmf_device_register(self, NULL, NULL))
aprint_error_dev(self, "couldn't establish power handler\n");
sysctl_createv(&sc->sc_log, 0, NULL, &node,
0,

View File

@ -1,4 +1,4 @@
/* $NetBSD: gffb.c,v 1.11 2016/07/11 11:31:51 msaitoh Exp $ */
/* $NetBSD: gffb.c,v 1.12 2017/01/20 12:25:07 maya Exp $ */
/*
* Copyright (c) 2013 Michael Lorenz
@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: gffb.c,v 1.11 2016/07/11 11:31:51 msaitoh Exp $");
__KERNEL_RCSID(0, "$NetBSD: gffb.c,v 1.12 2017/01/20 12:25:07 maya Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -342,7 +342,9 @@ gffb_attach(device_t parent, device_t self, void *aux)
}
/* no suspend/resume support yet */
pmf_device_register(sc->sc_dev, NULL, NULL);
if (!pmf_device_register(sc->sc_dev, NULL, NULL))
aprint_error_dev(sc->sc_dev,
"couldn't establish power handler\n");
aa.console = is_console;
aa.scrdata = &sc->sc_screenlist;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ibmcd.c,v 1.2 2016/07/14 10:19:06 msaitoh Exp $ */
/* $NetBSD: ibmcd.c,v 1.3 2017/01/20 12:25:07 maya Exp $ */
/*
* Copyright (c) 2012 Marc Balmer <marc@msys.ch>
@ -114,7 +114,8 @@ ibmcd_attach(device_t parent, device_t self, void *aux)
aprint_normal(": IBM 4810 BSP cash drawer\n");
#if (__NetBSD_Version__ >= 600000000)
pmf_device_register(self, ibmcd_suspend, ibmcd_resume);
if (!pmf_device_register(self, ibmcd_suspend, ibmcd_resume))
aprint_error_dev(self, "couldn't establish power handler\n");
#endif
/* Initialize pins array */
sc->sc_gpio_pins[PIN_OPEN].pin_num = 0;

View File

@ -1,4 +1,4 @@
/* $$NetBSD: pwdog.c,v 1.9 2016/07/14 10:19:06 msaitoh Exp $ */
/* $$NetBSD: pwdog.c,v 1.10 2017/01/20 12:25:07 maya Exp $ */
/* $OpenBSD: pwdog.c,v 1.7 2010/04/08 00:23:53 tedu Exp $ */
/*
@ -96,7 +96,8 @@ pwdog_attach(device_t parent, device_t self, void *aux)
sc->sc_dev = self;
pmf_device_register(self, pwdog_suspend, pwdog_resume);
if (!pmf_device_register(self, pwdog_suspend, pwdog_resume))
aprint_error_dev(self, "couldn't establish power handler\n");
bus_space_write_1(sc->sc_iot, sc->sc_ioh, PWDOG_DISABLE, 0);
sc->sc_smw.smw_name = device_xname(self);

View File

@ -1,4 +1,4 @@
/* $NetBSD: r128fb.c,v 1.39 2015/09/16 16:52:54 macallan Exp $ */
/* $NetBSD: r128fb.c,v 1.40 2017/01/20 12:25:07 maya Exp $ */
/*
* Copyright (c) 2007, 2012 Michael Lorenz
@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: r128fb.c,v 1.39 2015/09/16 16:52:54 macallan Exp $");
__KERNEL_RCSID(0, "$NetBSD: r128fb.c,v 1.40 2017/01/20 12:25:07 maya Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -332,7 +332,9 @@ r128fb_attach(device_t parent, device_t self, void *aux)
}
/* no suspend/resume support yet */
pmf_device_register(sc->sc_dev, NULL, NULL);
if (!pmf_device_register(sc->sc_dev, NULL, NULL))
aprint_error_dev(sc->sc_dev,
"couldn't establish power handler\n");
reg = bus_space_read_4(sc->sc_memt, sc->sc_regh, R128_LVDS_GEN_CNTL);
DPRINTF("R128_LVDS_GEN_CNTL: %08x\n", reg);

View File

@ -1,4 +1,4 @@
/* $NetBSD: sec.c,v 1.16 2014/01/21 19:50:16 christos Exp $ */
/* $NetBSD: sec.c,v 1.17 2017/01/20 12:25:07 maya Exp $ */
/*-
* Copyright (c) 2000, 2001, 2006 Ben Harris
@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: sec.c,v 1.16 2014/01/21 19:50:16 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: sec.c,v 1.17 2017/01/20 12:25:07 maya Exp $");
#include <sys/param.h>
@ -214,7 +214,9 @@ sec_attach(device_t parent, device_t self, void *aux)
sec_cli(sc);
sc->sc_mpr |= SEC_MPR_IE;
bus_space_write_1(sc->sc_pod_t, sc->sc_pod_h, SEC_MPR, sc->sc_mpr);
pmf_device_register1(sc->sc_sbic.sc_dev, NULL, NULL, sec_shutdown);
if (!pmf_device_register1(sc->sc_sbic.sc_dev, NULL, NULL, sec_shutdown))
aprint_error_dev(sc->sc_sbic.sc_dev,
"couldn't establish power handler\n");
}
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: irmce.c,v 1.2 2016/04/23 10:15:32 skrll Exp $ */
/* $NetBSD: irmce.c,v 1.3 2017/01/20 12:25:07 maya Exp $ */
/*-
* Copyright (c) 2011 Jared D. McNeill <jmcneill@invisible.ca>
@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: irmce.c,v 1.2 2016/04/23 10:15:32 skrll Exp $");
__KERNEL_RCSID(0, "$NetBSD: irmce.c,v 1.3 2017/01/20 12:25:07 maya Exp $");
#include <sys/types.h>
#include <sys/param.h>
@ -150,7 +150,8 @@ irmce_attach(device_t parent, device_t self, void *opaque)
unsigned int i;
uint8_t nep;
pmf_device_register(self, NULL, NULL);
if (!pmf_device_register(self, NULL, NULL))
aprint_error_dev(self, "couldn't establish power handler\n");
aprint_naive("\n");

View File

@ -198,7 +198,8 @@ i915drm_attach(device_t parent, device_t self, void *aux)
i915_configure(dev);
pmf_device_register(self, i915drm_suspend, i915drm_resume);
if (!pmf_device_register(self, i915drm_suspend, i915drm_resume))
aprint_error_dev(self, "couldn't establish power handler\n");
drm_attach(self, pa, i915_pciidlist);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: radeondrmkmsfb.c,v 1.6 2015/11/05 20:52:46 mrg Exp $ */
/* $NetBSD: radeondrmkmsfb.c,v 1.7 2017/01/20 12:25:07 maya Exp $ */
/*-
* Copyright (c) 2014 The NetBSD Foundation, Inc.
@ -31,7 +31,7 @@
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: radeondrmkmsfb.c,v 1.6 2015/11/05 20:52:46 mrg Exp $");
__KERNEL_RCSID(0, "$NetBSD: radeondrmkmsfb.c,v 1.7 2017/01/20 12:25:07 maya Exp $");
#ifdef _KERNEL_OPT
#include "vga.h"
@ -211,8 +211,10 @@ radeonfb_setconfig_task(struct radeon_task *task)
}
sc->sc_attached = true;
pmf_device_register1(sc->sc_dev, NULL, NULL,
radeonfb_genfb_shutdown);
if (!pmf_device_register1(sc->sc_dev, NULL, NULL,
radeonfb_genfb_shutdown))
aprint_error_dev(sc->sc_dev,
"couldn't establish power handler\n");
/* Success! */
sc->sc_scheduled = false;

View File

@ -1,4 +1,4 @@
/* $NetBSD: lua.c,v 1.18 2016/07/14 04:00:46 msaitoh Exp $ */
/* $NetBSD: lua.c,v 1.19 2017/01/20 12:25:07 maya Exp $ */
/*
* Copyright (c) 2014 by Lourival Vieira Neto <lneto@NetBSD.org>.
@ -141,7 +141,8 @@ lua_attach(device_t parent, device_t self, void *aux)
mutex_init(&sc->sc_state_lock, MUTEX_DEFAULT, IPL_VM);
cv_init(&sc->sc_state_cv, "luastate");
pmf_device_register(self, NULL, NULL);
if (!pmf_device_register(self, NULL, NULL))
aprint_error_dev(self, "couldn't establish power handler\n");
/* Sysctl to provide some control over behaviour */
sysctl_createv(&sc->sc_log, 0, NULL, &node,