aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath5k
diff options
context:
space:
mode:
authorBob Copeland <me@bobcopeland.com>2009-01-01 15:01:45 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-01-29 15:59:45 -0500
commit7d969204882882585336b0fa19ad4587d8fb15a2 (patch)
treef300de1b35bf0cca9d77a9896d9fd9227e7382d9 /drivers/net/wireless/ath5k
parent63649b6cf0a964582af2b4d4734e28ca90ec8f5c (diff)
ath5k: fix off-by-one in gpio checks
Sanity checks against AR5K_NUM_GPIO were all broken. This doesn't currently cause any problems since we only use the first four gpios. Changes-licensed-under: ISC Reported-by: Andreas Mohr <andi@lisas.de> Signed-off-by: Bob Copeland <me@bobcopeland.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath5k')
-rw-r--r--drivers/net/wireless/ath5k/gpio.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/net/wireless/ath5k/gpio.c b/drivers/net/wireless/ath5k/gpio.c
index b77205adc180..64a27e73d02e 100644
--- a/drivers/net/wireless/ath5k/gpio.c
+++ b/drivers/net/wireless/ath5k/gpio.c
@@ -83,7 +83,7 @@ void ath5k_hw_set_ledstate(struct ath5k_hw *ah, unsigned int state)
83int ath5k_hw_set_gpio_input(struct ath5k_hw *ah, u32 gpio) 83int ath5k_hw_set_gpio_input(struct ath5k_hw *ah, u32 gpio)
84{ 84{
85 ATH5K_TRACE(ah->ah_sc); 85 ATH5K_TRACE(ah->ah_sc);
86 if (gpio > AR5K_NUM_GPIO) 86 if (gpio >= AR5K_NUM_GPIO)
87 return -EINVAL; 87 return -EINVAL;
88 88
89 ath5k_hw_reg_write(ah, 89 ath5k_hw_reg_write(ah,
@@ -99,7 +99,7 @@ int ath5k_hw_set_gpio_input(struct ath5k_hw *ah, u32 gpio)
99int ath5k_hw_set_gpio_output(struct ath5k_hw *ah, u32 gpio) 99int ath5k_hw_set_gpio_output(struct ath5k_hw *ah, u32 gpio)
100{ 100{
101 ATH5K_TRACE(ah->ah_sc); 101 ATH5K_TRACE(ah->ah_sc);
102 if (gpio > AR5K_NUM_GPIO) 102 if (gpio >= AR5K_NUM_GPIO)
103 return -EINVAL; 103 return -EINVAL;
104 104
105 ath5k_hw_reg_write(ah, 105 ath5k_hw_reg_write(ah,
@@ -115,7 +115,7 @@ int ath5k_hw_set_gpio_output(struct ath5k_hw *ah, u32 gpio)
115u32 ath5k_hw_get_gpio(struct ath5k_hw *ah, u32 gpio) 115u32 ath5k_hw_get_gpio(struct ath5k_hw *ah, u32 gpio)
116{ 116{
117 ATH5K_TRACE(ah->ah_sc); 117 ATH5K_TRACE(ah->ah_sc);
118 if (gpio > AR5K_NUM_GPIO) 118 if (gpio >= AR5K_NUM_GPIO)
119 return 0xffffffff; 119 return 0xffffffff;
120 120
121 /* GPIO input magic */ 121 /* GPIO input magic */
@@ -131,7 +131,7 @@ int ath5k_hw_set_gpio(struct ath5k_hw *ah, u32 gpio, u32 val)
131 u32 data; 131 u32 data;
132 ATH5K_TRACE(ah->ah_sc); 132 ATH5K_TRACE(ah->ah_sc);
133 133
134 if (gpio > AR5K_NUM_GPIO) 134 if (gpio >= AR5K_NUM_GPIO)
135 return -EINVAL; 135 return -EINVAL;
136 136
137 /* GPIO output magic */ 137 /* GPIO output magic */
@@ -154,7 +154,7 @@ void ath5k_hw_set_gpio_intr(struct ath5k_hw *ah, unsigned int gpio,
154 u32 data; 154 u32 data;
155 155
156 ATH5K_TRACE(ah->ah_sc); 156 ATH5K_TRACE(ah->ah_sc);
157 if (gpio > AR5K_NUM_GPIO) 157 if (gpio >= AR5K_NUM_GPIO)
158 return; 158 return;
159 159
160 /* 160 /*