diff options
author | Enrico Scholz <enrico.scholz@sigma-chemnitz.de> | 2009-10-11 05:52:48 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-03-02 17:53:06 -0500 |
commit | 4fdb31d9665a9106190d9f8888cf06252c20f3ce (patch) | |
tree | d63ac40caa8a1b16b25f0827c5b1c8fc0573d1f7 /drivers/usb | |
parent | 2f0e40aba1cafe3a834bfcbac8f1e704d496dab9 (diff) |
USB: pxa27x_udc: avoid compiler warnings and misbehavior on buggy hardware
hardware reports wrong interrupt. Although such a situation should not
happen, the compiler complains about this access.
This patch adds a sanity check and generates warning to detect such
issues.
Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
Acked-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/gadget/pxa27x_udc.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/drivers/usb/gadget/pxa27x_udc.c b/drivers/usb/gadget/pxa27x_udc.c index adda1208a1ec..d4c6eec70edc 100644 --- a/drivers/usb/gadget/pxa27x_udc.c +++ b/drivers/usb/gadget/pxa27x_udc.c | |||
@@ -2218,9 +2218,13 @@ static void irq_handle_data(int irq, struct pxa_udc *udc) | |||
2218 | continue; | 2218 | continue; |
2219 | 2219 | ||
2220 | udc_writel(udc, UDCISR0, UDCISR_INT(i, UDCISR_INT_MASK)); | 2220 | udc_writel(udc, UDCISR0, UDCISR_INT(i, UDCISR_INT_MASK)); |
2221 | ep = &udc->pxa_ep[i]; | 2221 | |
2222 | ep->stats.irqs++; | 2222 | WARN_ON(i >= ARRAY_SIZE(udc->pxa_ep)); |
2223 | handle_ep(ep); | 2223 | if (i < ARRAY_SIZE(udc->pxa_ep)) { |
2224 | ep = &udc->pxa_ep[i]; | ||
2225 | ep->stats.irqs++; | ||
2226 | handle_ep(ep); | ||
2227 | } | ||
2224 | } | 2228 | } |
2225 | 2229 | ||
2226 | for (i = 16; udcisr1 != 0 && i < 24; udcisr1 >>= 2, i++) { | 2230 | for (i = 16; udcisr1 != 0 && i < 24; udcisr1 >>= 2, i++) { |
@@ -2228,9 +2232,12 @@ static void irq_handle_data(int irq, struct pxa_udc *udc) | |||
2228 | if (!(udcisr1 & UDCISR_INT_MASK)) | 2232 | if (!(udcisr1 & UDCISR_INT_MASK)) |
2229 | continue; | 2233 | continue; |
2230 | 2234 | ||
2231 | ep = &udc->pxa_ep[i]; | 2235 | WARN_ON(i >= ARRAY_SIZE(udc->pxa_ep)); |
2232 | ep->stats.irqs++; | 2236 | if (i < ARRAY_SIZE(udc->pxa_ep)) { |
2233 | handle_ep(ep); | 2237 | ep = &udc->pxa_ep[i]; |
2238 | ep->stats.irqs++; | ||
2239 | handle_ep(ep); | ||
2240 | } | ||
2234 | } | 2241 | } |
2235 | 2242 | ||
2236 | } | 2243 | } |