Re: drivers/usb/cdns3/cdnsp-gadget.c:168:9: sparse: sparse: cast from restricted __le32

"Arnd Bergmann" <[email protected]>
Newsgroups dev.linux.lists.oe-kbuild-all,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.