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>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
2f0e40aba1
commit
4fdb31d966
@@ -2218,9 +2218,13 @@ static void irq_handle_data(int irq, struct pxa_udc *udc)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
udc_writel(udc, UDCISR0, UDCISR_INT(i, UDCISR_INT_MASK));
|
udc_writel(udc, UDCISR0, UDCISR_INT(i, UDCISR_INT_MASK));
|
||||||
ep = &udc->pxa_ep[i];
|
|
||||||
ep->stats.irqs++;
|
WARN_ON(i >= ARRAY_SIZE(udc->pxa_ep));
|
||||||
handle_ep(ep);
|
if (i < ARRAY_SIZE(udc->pxa_ep)) {
|
||||||
|
ep = &udc->pxa_ep[i];
|
||||||
|
ep->stats.irqs++;
|
||||||
|
handle_ep(ep);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 16; udcisr1 != 0 && i < 24; udcisr1 >>= 2, i++) {
|
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)
|
|||||||
if (!(udcisr1 & UDCISR_INT_MASK))
|
if (!(udcisr1 & UDCISR_INT_MASK))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
ep = &udc->pxa_ep[i];
|
WARN_ON(i >= ARRAY_SIZE(udc->pxa_ep));
|
||||||
ep->stats.irqs++;
|
if (i < ARRAY_SIZE(udc->pxa_ep)) {
|
||||||
handle_ep(ep);
|
ep = &udc->pxa_ep[i];
|
||||||
|
ep->stats.irqs++;
|
||||||
|
handle_ep(ep);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user