* drivers/usb/cdns3/cdnsp-gadget.c:168:9: sparse: sparse: cast from restricted __le32
@ 2026-07-18 7:49 kernel test robot
2026-07-18 9:30 ` Arnd Bergmann
0 siblings, 1 reply; 2+ messages in thread
From: kernel test robot @ 2026-07-18 7:49 UTC (permalink / raw)
To: Peter Chen; +Cc: oe-kbuild-all, linux-kernel, Arnd Bergmann
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 94515f3a7d4256a5062176b7d6ed0471938cd51a
commit: e4d7362dc9cd50b0fc74c8649aa241376c48936c usb: cdns3: Add USBSSP platform driver support
date: 3 months ago
config: arc-randconfig-r123-20260716 (https://download.01.org/0day-ci/archive/20260718/202607181505.CVpdSKHV-lkp@intel.com/config)
compiler: arc-linux-gcc (GCC) 11.5.0
sparse: v0.6.5-rc1
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260718/202607181505.CVpdSKHV-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Fixes: e4d7362dc9cd ("usb: cdns3: Add USBSSP platform driver support")
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202607181505.CVpdSKHV-lkp@intel.com/
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
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
drivers/usb/cdns3/cdnsp-gadget.c:168:9: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] val @@ got restricted __le32 [usertype] @@
drivers/usb/cdns3/cdnsp-gadget.c:168:9: sparse: expected unsigned int [usertype] val
drivers/usb/cdns3/cdnsp-gadget.c:168:9: sparse: got restricted __le32 [usertype]
>> drivers/usb/cdns3/cdnsp-gadget.c:168:9: sparse: sparse: cast from restricted __le32
>> drivers/usb/cdns3/cdnsp-gadget.c:168:9: sparse: sparse: cast from restricted __le32
>> drivers/usb/cdns3/cdnsp-gadget.c:168:9: sparse: sparse: cast from restricted __le32
>> drivers/usb/cdns3/cdnsp-gadget.c:168:9: sparse: sparse: cast from restricted __le32
vim +168 drivers/usb/cdns3/cdnsp-gadget.c
3d82904559f4f5 Pawel Laszczak 2020-12-07 150
241e2ce88e5a49 Pawel Laszczak 2025-04-18 151 static void cdnsp_set_apb_timeout_value(struct cdnsp_device *pdev)
241e2ce88e5a49 Pawel Laszczak 2025-04-18 152 {
241e2ce88e5a49 Pawel Laszczak 2025-04-18 153 struct cdns *cdns = dev_get_drvdata(pdev->dev);
241e2ce88e5a49 Pawel Laszczak 2025-04-18 154 __le32 __iomem *reg;
241e2ce88e5a49 Pawel Laszczak 2025-04-18 155 void __iomem *base;
241e2ce88e5a49 Pawel Laszczak 2025-04-18 156 u32 offset = 0;
241e2ce88e5a49 Pawel Laszczak 2025-04-18 157 u32 val;
241e2ce88e5a49 Pawel Laszczak 2025-04-18 158
241e2ce88e5a49 Pawel Laszczak 2025-04-18 159 if (!cdns->override_apb_timeout)
241e2ce88e5a49 Pawel Laszczak 2025-04-18 160 return;
241e2ce88e5a49 Pawel Laszczak 2025-04-18 161
241e2ce88e5a49 Pawel Laszczak 2025-04-18 162 base = &pdev->cap_regs->hc_capbase;
241e2ce88e5a49 Pawel Laszczak 2025-04-18 163 offset = cdnsp_find_next_ext_cap(base, offset, D_XEC_PRE_REGS_CAP);
241e2ce88e5a49 Pawel Laszczak 2025-04-18 164 reg = base + offset + REG_CHICKEN_BITS_3_OFFSET;
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);
241e2ce88e5a49 Pawel Laszczak 2025-04-18 @168 writel(cpu_to_le32(val), reg);
241e2ce88e5a49 Pawel Laszczak 2025-04-18 169 }
241e2ce88e5a49 Pawel Laszczak 2025-04-18 170
:::::: The code at line 168 was first introduced by commit
:::::: 241e2ce88e5a494be7a5d44c0697592f1632fbee usb: cdnsp: Fix issue with resuming from L1
:::::: TO: Pawel Laszczak <pawell@cadence.com>
:::::: CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: drivers/usb/cdns3/cdnsp-gadget.c:168:9: sparse: sparse: cast from restricted __le32
2026-07-18 7:49 drivers/usb/cdns3/cdnsp-gadget.c:168:9: sparse: sparse: cast from restricted __le32 kernel test robot
@ 2026-07-18 9:30 ` Arnd Bergmann
0 siblings, 0 replies; 2+ messages in thread
From: Arnd Bergmann @ 2026-07-18 9:30 UTC (permalink / raw)
To: kernel test robot, Peter Chen; +Cc: oe-kbuild-all, linux-kernel, Pawel Laszczak
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-07-18 9:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-18 7:49 drivers/usb/cdns3/cdnsp-gadget.c:168:9: sparse: sparse: cast from restricted __le32 kernel test robot
2026-07-18 9:30 ` Arnd Bergmann
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.