]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
usb: cdnsp: fix incorrect endian conversions for APB timeout register
authorPawel Laszczak <pawell@cadence.com>
Mon, 20 Jul 2026 11:11:58 +0000 (13:11 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 3 Aug 2026 15:23:47 +0000 (17:23 +0200)
readl() already returns a CPU-endian value. Passing its return value to
le32_to_cpu() is therefore redundant and causes an incorrect double byte
swap on big-endian systems.

Similarly, writel() expects a CPU-endian value, so passing the result of
cpu_to_le32() is incorrect.

Remove the unnecessary conversions and operate on the MMIO register value
as a CPU-endian u32.

Fixes: 241e2ce88e5a ("usb: cdnsp: Fix issue with resuming from L1")
Suggested-by: Arnd Bergmann <arnd@arndb.de>
Cc: stable <stable@kernel.org>
Signed-off-by: Pawel Laszczak <pawell@cadence.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Link: https://patch.msgid.link/20260720-endian-fix-v1-v1-1-b5681fa1ea9f@cadence.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/cdns3/cdnsp-gadget.c

index a5275c2fb43b8ef4d9db69bac077f11e332f6c3a..7a516e509198b8def7626393243da7166c5c0e6b 100644 (file)
@@ -163,9 +163,9 @@ static void cdnsp_set_apb_timeout_value(struct cdnsp_device *pdev)
        offset = cdnsp_find_next_ext_cap(base, offset, D_XEC_PRE_REGS_CAP);
        reg = base + offset + REG_CHICKEN_BITS_3_OFFSET;
 
-       val  = le32_to_cpu(readl(reg));
+       val  = readl(reg);
        val = CHICKEN_APB_TIMEOUT_SET(val, cdns->override_apb_timeout);
-       writel(cpu_to_le32(val), reg);
+       writel(val, reg);
 }
 
 static void cdnsp_set_chicken_bits_2(struct cdnsp_device *pdev, u32 bit)