Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4fdb31d9 authored by Enrico Scholz's avatar Enrico Scholz Committed by Greg Kroah-Hartman
Browse files

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: default avatarEnrico Scholz <enrico.scholz@sigma-chemnitz.de>
Acked-by: default avatarRobert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 2f0e40ab
Loading
Loading
Loading
Loading
+13 −6
Original line number Original line Diff line number Diff line
@@ -2218,20 +2218,27 @@ 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));

		WARN_ON(i >= ARRAY_SIZE(udc->pxa_ep));
		if (i < ARRAY_SIZE(udc->pxa_ep)) {
			ep = &udc->pxa_ep[i];
			ep = &udc->pxa_ep[i];
			ep->stats.irqs++;
			ep->stats.irqs++;
			handle_ep(ep);
			handle_ep(ep);
		}
		}
	}


	for (i = 16; udcisr1 != 0 && i < 24; udcisr1 >>= 2, i++) {
	for (i = 16; udcisr1 != 0 && i < 24; udcisr1 >>= 2, i++) {
		udc_writel(udc, UDCISR1, UDCISR_INT(i - 16, UDCISR_INT_MASK));
		udc_writel(udc, UDCISR1, UDCISR_INT(i - 16, UDCISR_INT_MASK));
		if (!(udcisr1 & UDCISR_INT_MASK))
		if (!(udcisr1 & UDCISR_INT_MASK))
			continue;
			continue;


		WARN_ON(i >= ARRAY_SIZE(udc->pxa_ep));
		if (i < ARRAY_SIZE(udc->pxa_ep)) {
			ep = &udc->pxa_ep[i];
			ep = &udc->pxa_ep[i];
			ep->stats.irqs++;
			ep->stats.irqs++;
			handle_ep(ep);
			handle_ep(ep);
		}
		}
	}


}
}