]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
net: dsa: realtek: rtl8365mb: fix mode mask calculation
authorMieczyslaw Nalewaj <namiltd@yahoo.com>
Sun, 19 Apr 2026 19:37:07 +0000 (21:37 +0200)
committerPaolo Abeni <pabeni@redhat.com>
Thu, 23 Apr 2026 08:50:33 +0000 (10:50 +0200)
The RTL8365MB_DIGITAL_INTERFACE_SELECT_MODE_MASK macro was shifting
the 4-bit mask (0xF) by only (_extint % 2) bits instead of
(_extint % 2) * 4. This caused the mask to overlap with the adjacent
nibble when configuring odd-numbered external interfaces, selecting
the wrong bits entirely.

Align the shift calculation with the existing ...MODE_OFFSET macro.

Fixes: 4af2950c50c8 ("net: dsa: realtek-smi: add rtl8365mb subdriver for RTL8365MB-VC")
Signed-off-by: Abdulkader Alrezej <alrazj.abdulkader@gmail.com>
Signed-off-by: Mieczyslaw Nalewaj <namiltd@yahoo.com>
Reviewed-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
Link: https://patch.msgid.link/400a6387-a444-4576-af6d-26be5410bce3@yahoo.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/dsa/realtek/rtl8365mb.c

index 31fa94dac627d6ed3bf8f9a0ff0f17b954c62c0d..c35cef01ec265e0d600de1b7707f7f68453952c3 100644 (file)
                 (_extint) == 2 ? RTL8365MB_DIGITAL_INTERFACE_SELECT_REG1 : \
                 0x0)
 #define   RTL8365MB_DIGITAL_INTERFACE_SELECT_MODE_MASK(_extint) \
-               (0xF << (((_extint) % 2)))
+               (0xF << (((_extint) % 2) * 4))
 #define   RTL8365MB_DIGITAL_INTERFACE_SELECT_MODE_OFFSET(_extint) \
                (((_extint) % 2) * 4)