Re: drivers/usb/cdns3/cdnsp-gadget.c:168:9: sparse: sparse: cast from restricted __le32
From: Arnd Bergmann
Date: Sat Jul 18 2026 - 05:31:19 EST
On Sat, Jul 18, 2026, at 09:49, kernel test robot wrote:
> sparse warnings: (new ones prefixed by >>)
> drivers/usb/cdns3/cdnsp-gadget.c:166:16: sparse: sparse: cast to
> restricted __le32
> drivers/usb/cdns3/cdnsp-gadget.c:166:16: sparse: sparse: cast to
> restricted __le32
> drivers/usb/cdns3/cdnsp-gadget.c:166:16: sparse: sparse: cast to
> restricted __le32
This is clearly a bug in the driver, introduced in commit
241e2ce88e5a ("usb: cdnsp: Fix issue with resuming from L1"):
> 241e2ce88e5a49 Pawel Laszczak 2025-04-18 165
> 241e2ce88e5a49 Pawel Laszczak 2025-04-18 @166 val =
> le32_to_cpu(readl(reg));
> 241e2ce88e5a49 Pawel Laszczak 2025-04-18 167 val =
> CHICKEN_APB_TIMEOUT_SET(val, cdns->override_apb_timeout);
This is broken on big-endian machines, because readl() contains
an implicit byteswap, and the extra le32_to_cpu() swaps the
value back.
Pawel, can you fix this and address any additional sparse warnings
you see in this file?
Arnd