Remove parameter checks from under DEBUG; bad gpio pin numbers will cause

the kernel to fall over rather quickly anyway with memory faults, so a panic
with a hint as to what's wrong seems much better.
This commit is contained in:
rafal 2008-11-07 16:13:16 +00:00
parent a455765d91
commit 155980bdb0

View File

@ -1,4 +1,4 @@
/* $NetBSD: pxa2x0_gpio.c,v 1.10 2008/04/24 11:46:30 nonaka Exp $ */ /* $NetBSD: pxa2x0_gpio.c,v 1.11 2008/11/07 16:13:16 rafal Exp $ */
/* /*
* Copyright 2003 Wasabi Systems, Inc. * Copyright 2003 Wasabi Systems, Inc.
@ -36,7 +36,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: pxa2x0_gpio.c,v 1.10 2008/04/24 11:46:30 nonaka Exp $"); __KERNEL_RCSID(0, "$NetBSD: pxa2x0_gpio.c,v 1.11 2008/11/07 16:13:16 rafal Exp $");
#include "opt_pxa2x0_gpio.h" #include "opt_pxa2x0_gpio.h"
@ -202,14 +202,12 @@ pxa2x0_gpio_intr_establish(u_int gpio, int level, int spl, int (*func)(void *),
struct gpio_irq_handler *gh; struct gpio_irq_handler *gh;
u_int32_t bit, reg; u_int32_t bit, reg;
#ifdef DEBUG
#ifdef PXAGPIO_HAS_GPION_INTRS #ifdef PXAGPIO_HAS_GPION_INTRS
if (gpio >= GPIO_NPINS) if (gpio >= GPIO_NPINS)
panic("pxa2x0_gpio_intr_establish: bad pin number: %d", gpio); panic("pxa2x0_gpio_intr_establish: bad pin number: %d", gpio);
#else #else
if (gpio > 1) if (gpio > 1)
panic("pxa2x0_gpio_intr_establish: bad pin number: %d", gpio); panic("pxa2x0_gpio_intr_establish: bad pin number: %d", gpio);
#endif
#endif #endif
if (!GPIO_IS_GPIO_IN(pxa2x0_gpio_get_function(gpio))) if (!GPIO_IS_GPIO_IN(pxa2x0_gpio_get_function(gpio)))