diff options
author | Björn Steinbrink <B.Steinbrink@gmx.de> | 2008-03-30 22:22:53 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-04-17 11:40:45 -0400 |
commit | 223ac2f42d49dd0324ca02ea15897ead1a2f5133 (patch) | |
tree | 662ec6d6e8e467c6397fa86423ceadb3c62f4b60 | |
parent | 4b119e21d0c66c22e8ca03df05d9de623d0eb50f (diff) |
x86, pci: fix off-by-one errors in some pirq warnings
fix bogus pirq warnings reported in:
http://bugzilla.kernel.org/show_bug.cgi?id=10366
safe to be backported to v2.6.25 and earlier.
Cc: stable@kernel.org
Signed-off-by: Björn Steinbrink <B.Steinbrink@gmx.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | arch/x86/pci/irq.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/arch/x86/pci/irq.c b/arch/x86/pci/irq.c index a8715861877e..579745ca6b66 100644 --- a/arch/x86/pci/irq.c +++ b/arch/x86/pci/irq.c | |||
@@ -200,7 +200,7 @@ static int pirq_ali_get(struct pci_dev *router, struct pci_dev *dev, int pirq) | |||
200 | { | 200 | { |
201 | static const unsigned char irqmap[16] = { 0, 9, 3, 10, 4, 5, 7, 6, 1, 11, 0, 12, 0, 14, 0, 15 }; | 201 | static const unsigned char irqmap[16] = { 0, 9, 3, 10, 4, 5, 7, 6, 1, 11, 0, 12, 0, 14, 0, 15 }; |
202 | 202 | ||
203 | WARN_ON_ONCE(pirq >= 16); | 203 | WARN_ON_ONCE(pirq > 16); |
204 | return irqmap[read_config_nybble(router, 0x48, pirq-1)]; | 204 | return irqmap[read_config_nybble(router, 0x48, pirq-1)]; |
205 | } | 205 | } |
206 | 206 | ||
@@ -209,7 +209,7 @@ static int pirq_ali_set(struct pci_dev *router, struct pci_dev *dev, int pirq, i | |||
209 | static const unsigned char irqmap[16] = { 0, 8, 0, 2, 4, 5, 7, 6, 0, 1, 3, 9, 11, 0, 13, 15 }; | 209 | static const unsigned char irqmap[16] = { 0, 8, 0, 2, 4, 5, 7, 6, 0, 1, 3, 9, 11, 0, 13, 15 }; |
210 | unsigned int val = irqmap[irq]; | 210 | unsigned int val = irqmap[irq]; |
211 | 211 | ||
212 | WARN_ON_ONCE(pirq >= 16); | 212 | WARN_ON_ONCE(pirq > 16); |
213 | if (val) { | 213 | if (val) { |
214 | write_config_nybble(router, 0x48, pirq-1, val); | 214 | write_config_nybble(router, 0x48, pirq-1, val); |
215 | return 1; | 215 | return 1; |
@@ -260,7 +260,7 @@ static int pirq_via586_get(struct pci_dev *router, struct pci_dev *dev, int pirq | |||
260 | { | 260 | { |
261 | static const unsigned int pirqmap[5] = { 3, 2, 5, 1, 1 }; | 261 | static const unsigned int pirqmap[5] = { 3, 2, 5, 1, 1 }; |
262 | 262 | ||
263 | WARN_ON_ONCE(pirq >= 5); | 263 | WARN_ON_ONCE(pirq > 5); |
264 | return read_config_nybble(router, 0x55, pirqmap[pirq-1]); | 264 | return read_config_nybble(router, 0x55, pirqmap[pirq-1]); |
265 | } | 265 | } |
266 | 266 | ||
@@ -268,7 +268,7 @@ static int pirq_via586_set(struct pci_dev *router, struct pci_dev *dev, int pirq | |||
268 | { | 268 | { |
269 | static const unsigned int pirqmap[5] = { 3, 2, 5, 1, 1 }; | 269 | static const unsigned int pirqmap[5] = { 3, 2, 5, 1, 1 }; |
270 | 270 | ||
271 | WARN_ON_ONCE(pirq >= 5); | 271 | WARN_ON_ONCE(pirq > 5); |
272 | write_config_nybble(router, 0x55, pirqmap[pirq-1], irq); | 272 | write_config_nybble(router, 0x55, pirqmap[pirq-1], irq); |
273 | return 1; | 273 | return 1; |
274 | } | 274 | } |
@@ -282,7 +282,7 @@ static int pirq_ite_get(struct pci_dev *router, struct pci_dev *dev, int pirq) | |||
282 | { | 282 | { |
283 | static const unsigned char pirqmap[4] = { 1, 0, 2, 3 }; | 283 | static const unsigned char pirqmap[4] = { 1, 0, 2, 3 }; |
284 | 284 | ||
285 | WARN_ON_ONCE(pirq >= 4); | 285 | WARN_ON_ONCE(pirq > 4); |
286 | return read_config_nybble(router,0x43, pirqmap[pirq-1]); | 286 | return read_config_nybble(router,0x43, pirqmap[pirq-1]); |
287 | } | 287 | } |
288 | 288 | ||
@@ -290,7 +290,7 @@ static int pirq_ite_set(struct pci_dev *router, struct pci_dev *dev, int pirq, i | |||
290 | { | 290 | { |
291 | static const unsigned char pirqmap[4] = { 1, 0, 2, 3 }; | 291 | static const unsigned char pirqmap[4] = { 1, 0, 2, 3 }; |
292 | 292 | ||
293 | WARN_ON_ONCE(pirq >= 4); | 293 | WARN_ON_ONCE(pirq > 4); |
294 | write_config_nybble(router, 0x43, pirqmap[pirq-1], irq); | 294 | write_config_nybble(router, 0x43, pirqmap[pirq-1], irq); |
295 | return 1; | 295 | return 1; |
296 | } | 296 | } |