usb: dwc3: core: Fix timeout check
authorVaradarajan Narayanan <quic_varada@quicinc.com>
Wed, 15 Jan 2025 06:20:44 +0000 (11:50 +0530)
committerMarek Vasut <marex@denx.de>
Sun, 25 May 2025 13:44:13 +0000 (15:44 +0200)
commit068f83499c2f8299c6172c511ec875eef2b26a6f
tree5ad1fd5b1d6c911fb1e4f3bbff924c1828fd9fd4
parentdf2ed552f0b05591090369a7fe7ddc92439dea5c
usb: dwc3: core: Fix timeout check

dwc3_core_init loops 'timeout' times to check if the IP block is out
of reset using 'while (timeout--)'. If there is some issue and
the block doesn't come out of reset, the loop will run till
'timeout' becomes zero and the post decrement operator would set
timeout to 0xffffffff. Though the IP block is not out reset, the
subsequent if check 'if !timeout' would fail as timeout is not
equal to zero and the function proceeds with the initialization.

Use poll API instead to resolve this.

Signed-off-by: Varadarajan Narayanan <quic_varada@quicinc.com>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org>
drivers/usb/dwc3/core.c