public inbox for drm-ai-reviews@public-inbox.freedesktop.org
 help / color / mirror / Atom feed
From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: video: fbdev: sm712: Fix operator precedence in big_swap macro
Date: Sat, 16 May 2026 10:14:54 +1000	[thread overview]
Message-ID: <review-patch1-20260515010202.2506-1-lirongqing@baidu.com> (raw)
In-Reply-To: <20260515010202.2506-1-lirongqing@baidu.com>

Patch Review

**Status: Correct fix for a real bug.**

The commit message clearly explains the problem: C operator precedence means `<<` and `>>` bind tighter than `&`, so the original code:

```c
#define big_swap(p)		((p & 0xff00ff00 >> 8) | (p & 0x00ff00ff << 8))
```

was parsed as:

```c
((p & (0xff00ff00 >> 8)) | (p & (0x00ff00ff << 8)))
```

which is `((p & 0x00ff00ff) | (p & 0xff00ff00))` — effectively just `p` (identity), completely defeating the byte swap.

The fix:

```c
#define big_swap(p)		(((p & 0xff00ff00) >> 8) | ((p & 0x00ff00ff) << 8))
```

correctly masks first, then shifts, implementing a proper swap of the high and low bytes within each 16-bit half of a 32-bit value.

**Verification:** All three call sites in `sm712fb.c` (lines 1010, 1069, 1141) use this for big-endian palette and framebuffer operations. The fix restores the intended byte-swap behavior that has been broken since the original merge.

**Nit (not blocking):** The macro argument `p` is not wrapped in parentheses (e.g., `(p)`) to guard against complex expressions. Since all current callers pass simple lvalues, this is a pre-existing cosmetic issue and not worth blocking the fix.

**Verdict: Reviewed-by worthy.** The Fixes tag correctly identifies the originating commit, and the fix is minimal and correct.

---
Generated by Claude Code Patch Reviewer

      parent reply	other threads:[~2026-05-16  0:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-15  1:02 [PATCH] video: fbdev: sm712: Fix operator precedence in big_swap macro lirongqing
2026-05-16  0:14 ` Claude review: " Claude Code Review Bot
2026-05-16  0:14 ` Claude Code Review Bot [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=review-patch1-20260515010202.2506-1-lirongqing@baidu.com \
    --to=claude-review@example.com \
    --cc=dri-devel-reviews@example.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox