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/fb19423f60f3
branches:  trunk
changeset: 796124:fb19423f60f3
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 e24abe30b51a -r fb19423f60f3 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