mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2026-09-22 09:34:56 +02:00
fbdev: sm712: Fix operator precedence in big_swap macro
commit5dbe5b65dfupstream. 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:1461d66728("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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
2952767e39
commit
2003759092
@@ -101,7 +101,7 @@ struct modeinit {
|
||||
#define mmio_addr 0x00800000
|
||||
#define seqw17() smtc_seqw(0x17, 0x30)
|
||||
#define big_pixel_depth(p, d) {if (p == 24) {p = 32; d = 32; } }
|
||||
#define big_swap(p) ((p & 0xff00ff00 >> 8) | (p & 0x00ff00ff << 8))
|
||||
#define big_swap(p) (((p & 0xff00ff00) >> 8) | ((p & 0x00ff00ff) << 8))
|
||||
#else
|
||||
#define pal_rgb(r, g, b, val) val
|
||||
#define big_addr 0
|
||||
|
||||
Reference in New Issue
Block a user