Source-Changes-HG archive

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

[src/trunk]: src/sys Check pmf_device_register return value. NFC



details:   https://anonhg.NetBSD.org/src/rev/cb4954d63e76
branches:  trunk
changeset: 350766:cb4954d63e76
user:      maya <maya%NetBSD.org@localhost>
date:      Fri Jan 20 12:25:07 2017 +0000

description:
Check pmf_device_register return value. NFC
Appeases static analyzers.

diffstat:

 sys/dev/drm/vbox_drv.c                        |   7 ++++---
 sys/dev/gpio/gpiolock.c                       |   5 +++--
 sys/dev/gpio/gpiopwm.c                        |   5 +++--
 sys/dev/gpio/gpiosim.c                        |   5 +++--
 sys/dev/pci/gffb.c                            |   8 +++++---
 sys/dev/pci/ibmcd.c                           |   5 +++--
 sys/dev/pci/pwdog.c                           |   5 +++--
 sys/dev/pci/r128fb.c                          |   8 +++++---
 sys/dev/podulebus/sec.c                       |   8 +++++---
 sys/dev/usb/irmce.c                           |   7 ++++---
 sys/external/bsd/drm/dist/bsd-core/i915_drv.c |   3 ++-
 sys/external/bsd/drm2/radeon/radeondrmkmsfb.c |  10 ++++++----
 sys/modules/lua/lua.c                         |   5 +++--
 13 files changed, 49 insertions(+), 32 deletions(-)

diffs (truncated from 301 to 300 lines):

diff -r 4e733f8296ba -r cb4954d63e76 sys/dev/drm/vbox_drv.c
--- a/sys/dev/drm/vbox_drv.c    Fri Jan 20 09:45:13 2017 +0000
+++ b/sys/dev/drm/vbox_drv.c    Fri Jan 20 12:25:07 2017 +0000
@@ -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@localhost>
@@ -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 @@
        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) {
diff -r 4e733f8296ba -r cb4954d63e76 sys/dev/gpio/gpiolock.c
--- a/sys/dev/gpio/gpiolock.c   Fri Jan 20 09:45:13 2017 +0000
+++ b/sys/dev/gpio/gpiolock.c   Fri Jan 20 12:25:07 2017 +0000
@@ -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@localhost>
@@ -123,7 +123,8 @@
                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;
diff -r 4e733f8296ba -r cb4954d63e76 sys/dev/gpio/gpiopwm.c
--- a/sys/dev/gpio/gpiopwm.c    Fri Jan 20 09:45:13 2017 +0000
+++ b/sys/dev/gpio/gpiopwm.c    Fri Jan 20 12:25:07 2017 +0000
@@ -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@localhost>
@@ -104,7 +104,8 @@
                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);
diff -r 4e733f8296ba -r cb4954d63e76 sys/dev/gpio/gpiosim.c
--- a/sys/dev/gpio/gpiosim.c    Fri Jan 20 09:45:13 2017 +0000
+++ b/sys/dev/gpio/gpiosim.c    Fri Jan 20 12:25:07 2017 +0000
@@ -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 @@
        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,
diff -r 4e733f8296ba -r cb4954d63e76 sys/dev/pci/gffb.c
--- a/sys/dev/pci/gffb.c        Fri Jan 20 09:45:13 2017 +0000
+++ b/sys/dev/pci/gffb.c        Fri Jan 20 12:25:07 2017 +0000
@@ -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 @@
        }
 
        /* 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;
diff -r 4e733f8296ba -r cb4954d63e76 sys/dev/pci/ibmcd.c
--- a/sys/dev/pci/ibmcd.c       Fri Jan 20 09:45:13 2017 +0000
+++ b/sys/dev/pci/ibmcd.c       Fri Jan 20 12:25:07 2017 +0000
@@ -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@localhost>
@@ -114,7 +114,8 @@
        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;
diff -r 4e733f8296ba -r cb4954d63e76 sys/dev/pci/pwdog.c
--- a/sys/dev/pci/pwdog.c       Fri Jan 20 09:45:13 2017 +0000
+++ b/sys/dev/pci/pwdog.c       Fri Jan 20 12:25:07 2017 +0000
@@ -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 @@
 
        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);
diff -r 4e733f8296ba -r cb4954d63e76 sys/dev/pci/r128fb.c
--- a/sys/dev/pci/r128fb.c      Fri Jan 20 09:45:13 2017 +0000
+++ b/sys/dev/pci/r128fb.c      Fri Jan 20 12:25:07 2017 +0000
@@ -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 @@
        }
 
        /* 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);
diff -r 4e733f8296ba -r cb4954d63e76 sys/dev/podulebus/sec.c
--- a/sys/dev/podulebus/sec.c   Fri Jan 20 09:45:13 2017 +0000
+++ b/sys/dev/podulebus/sec.c   Fri Jan 20 12:25:07 2017 +0000
@@ -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_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");
 }
 
 /*
diff -r 4e733f8296ba -r cb4954d63e76 sys/dev/usb/irmce.c
--- a/sys/dev/usb/irmce.c       Fri Jan 20 09:45:13 2017 +0000
+++ b/sys/dev/usb/irmce.c       Fri Jan 20 12:25:07 2017 +0000
@@ -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@localhost>
@@ -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 @@
        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");
 
diff -r 4e733f8296ba -r cb4954d63e76 sys/external/bsd/drm/dist/bsd-core/i915_drv.c
--- a/sys/external/bsd/drm/dist/bsd-core/i915_drv.c     Fri Jan 20 09:45:13 2017 +0000
+++ b/sys/external/bsd/drm/dist/bsd-core/i915_drv.c     Fri Jan 20 12:25:07 2017 +0000
@@ -198,7 +198,8 @@
 
        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);
 }
diff -r 4e733f8296ba -r cb4954d63e76 sys/external/bsd/drm2/radeon/radeondrmkmsfb.c
--- a/sys/external/bsd/drm2/radeon/radeondrmkmsfb.c     Fri Jan 20 09:45:13 2017 +0000
+++ b/sys/external/bsd/drm2/radeon/radeondrmkmsfb.c     Fri Jan 20 12:25:07 2017 +0000
@@ -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 @@
        }
        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;
diff -r 4e733f8296ba -r cb4954d63e76 sys/modules/lua/lua.c
--- a/sys/modules/lua/lua.c     Fri Jan 20 09:45:13 2017 +0000
+++ b/sys/modules/lua/lua.c     Fri Jan 20 12:25:07 2017 +0000
@@ -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@localhost>.
@@ -141,7 +141,8 @@
        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 */



Home | Main Index | Thread Index | Old Index