Module Name: src
Committed By: reinoud
Date: Wed May 21 12:18:24 UTC 2014
Modified Files:
src/sys/arch/arm/samsung: exynos_gpio.c
Log Message:
Don't panic if the pin is not available in pin_reserve() but return false
instead.
To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/samsung/exynos_gpio.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/arch/arm/samsung/exynos_gpio.c
diff -u src/sys/arch/arm/samsung/exynos_gpio.c:1.5 src/sys/arch/arm/samsung/exynos_gpio.c:1.6
--- src/sys/arch/arm/samsung/exynos_gpio.c:1.5 Fri May 16 10:02:24 2014
+++ src/sys/arch/arm/samsung/exynos_gpio.c Wed May 21 12:18:24 2014
@@ -32,7 +32,7 @@
#include "gpio.h"
#include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: exynos_gpio.c,v 1.5 2014/05/16 10:02:24 reinoud Exp $");
+__KERNEL_RCSID(1, "$NetBSD: exynos_gpio.c,v 1.6 2014/05/21 12:18:24 reinoud Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -725,8 +725,15 @@ exynos_gpio_pin_reserve(const char *name
}
KASSERT(grp);
- KASSERT(pinnr < grp->grp_bits);
- KASSERT(grp->grp_pin_mask & __BIT(pinnr));
+ /* in range? */
+ if (pinnr >= grp->grp_bits)
+ return false;
+
+ /* marked as connected? */
+ if ((grp->grp_pin_mask & __BIT(pinnr)) == 0)
+ return false;
+
+ /* it better not be used!! this is not taken lightly */
KASSERT((grp->grp_pin_inuse_mask & __BIT(pinnr)) == 0);
/* update our pin configuration */