Module Name: src Committed By: jmcneill Date: Thu Jul 6 14:26:00 UTC 2017
Modified Files: src/sys/dev/fdt: gpiokeys.c Log Message: Only read gpio pin if the pin is valid To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/dev/fdt/gpiokeys.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/fdt/gpiokeys.c diff -u src/sys/dev/fdt/gpiokeys.c:1.3 src/sys/dev/fdt/gpiokeys.c:1.4 --- src/sys/dev/fdt/gpiokeys.c:1.3 Thu Jul 6 14:01:38 2017 +++ src/sys/dev/fdt/gpiokeys.c Thu Jul 6 14:26:00 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: gpiokeys.c,v 1.3 2017/07/06 14:01:38 jmcneill Exp $ */ +/* $NetBSD: gpiokeys.c,v 1.4 2017/07/06 14:26:00 jmcneill Exp $ */ /*- * Copyright (c) 2015 Jared D. McNeill <jmcne...@invisible.ca> @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: gpiokeys.c,v 1.3 2017/07/06 14:01:38 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: gpiokeys.c,v 1.4 2017/07/06 14:26:00 jmcneill Exp $"); #include <sys/param.h> #include <sys/kernel.h> @@ -128,7 +128,8 @@ gpiokeys_attach(device_t parent, device_ key->key_debounce = debounce; key->key_pin = fdtbus_gpio_acquire(child, "gpios", GPIO_PIN_INPUT); - key->key_state = fdtbus_gpio_read(key->key_pin); + if (key->key_pin) + key->key_state = fdtbus_gpio_read(key->key_pin); key->key_pswitch.smpsw_name = key->key_label; switch (code) {