Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/arm/samsung Don't panic if the pin is not available...
details: https://anonhg.NetBSD.org/src/rev/259f3c171f3c
branches: trunk
changeset: 329363:259f3c171f3c
user: reinoud <reinoud%NetBSD.org@localhost>
date: Wed May 21 12:18:24 2014 +0000
description:
Don't panic if the pin is not available in pin_reserve() but return false
instead.
diffstat:
sys/arch/arm/samsung/exynos_gpio.c | 13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)
diffs (30 lines):
diff -r e3b2aa106e59 -r 259f3c171f3c sys/arch/arm/samsung/exynos_gpio.c
--- a/sys/arch/arm/samsung/exynos_gpio.c Wed May 21 12:16:17 2014 +0000
+++ b/sys/arch/arm/samsung/exynos_gpio.c Wed May 21 12:18:24 2014 +0000
@@ -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 @@
}
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 */
Home |
Main Index |
Thread Index |
Old Index