]> git.hungrycats.org Git - linux/commit
fbdev: sm712: Fix operator precedence in big_swap macro
authorLi RongQing <lirongqing@baidu.com>
Fri, 15 May 2026 01:02:02 +0000 (21:02 -0400)
committerHelge Deller <deller@gmx.de>
Tue, 9 Jun 2026 14:00:10 +0000 (16:00 +0200)
commit5dbe5b65df0b0c0ec77492427c274b7b5011890e
treed87cf5403f648a454c7364aed1ad77d54f8c5597
parentb15d708995c01bbffe7dcd634a31959f6805bed3
fbdev: sm712: Fix operator precedence in big_swap macro

The big_swap(p) macro was intended to swap bytes within 16-bit halves
of a 32-bit value. However, because the bitwise shift operators (<<, >>)
have higher precedence than the bitwise AND operator (&), the original
code failed to perform any shifting on the masked bits.

For example, 'p & 0xff00ff00 >> 8' was evaluated as 'p &
(0xff00ff00 >> 8)', effectively neutralizing the intended swap.

Fix this by adding parentheses to ensure the bitwise AND is performed
before the shift, correctly implementing the byte swap logic.

Fixes: 1461d66728648 ("staging: sm7xxfb: merge sm712fb with fbdev")
Cc: stable@vger.kernel.org
Signed-off-by: Li RongQing <lirongqing@baidu.com>
Signed-off-by: Helge Deller <deller@gmx.de>
drivers/video/fbdev/sm712.h