From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: drm/tiny: sharp-memory: avoid transmitting stale TX buffer data
Date: Tue, 31 Mar 2026 17:34:59 +1000 [thread overview]
Message-ID: <review-patch2-20260330-flickering-v1-2-5a192bf4b93d@axis.com> (raw)
In-Reply-To: <20260330-flickering-v1-2-5a192bf4b93d@axis.com>
Patch Review
**Analysis:** The original code always transmitted the full `smd->tx_buffer_size`:
```c
u32 tx_buffer_size = smd->tx_buffer_size;
// ...
ret = sharp_memory_spi_write(smd->spi, tx_buffer, tx_buffer_size);
```
Since `tx_buffer_size = 1 + pitch * vdisplay` (mode byte + all lines), and the buffer isn't zeroed between updates, a previous full-screen update leaves stale line entries in the buffer. When a subsequent partial update writes only a few lines, the old entries are still sent, causing the panel to overwrite correct content with stale data.
The fix computes the exact transfer length:
```c
u32 tx_len = 1 + (drm_rect_height(&clip) * pitch);
```
This is 1 byte (mode) + dirty_lines × pitch, which is correct. Each line's `pitch` already includes `SHARP_ADDR_PERIOD + hdisplay + SHARP_DUMMY_PERIOD` divided by 8, so the trailing dummy bits for the last transmitted line are included in the transfer, satisfying the Sharp Memory LCD protocol's requirement for a trailing dummy period.
The struct field `smd->tx_buffer_size` remains used for the `devm_kzalloc` allocation in `sharp_memory_probe()` (line 567), so it is not left dangling.
**No issues.** Correct fix, good commit message with proper Fixes tag.
---
Generated by Claude Code Patch Reviewer
next prev parent reply other threads:[~2026-03-31 7:34 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-30 7:20 [PATCH 0/2] drm/tiny: sharp-memory: fix TX buffer corruption on partial update Tobias Johansson
2026-03-30 7:20 ` [PATCH 1/2] drm/tiny: sharp-memory: fix line address assignment " Tobias Johansson
2026-03-31 7:34 ` Claude review: " Claude Code Review Bot
2026-03-30 7:20 ` [PATCH 2/2] drm/tiny: sharp-memory: avoid transmitting stale TX buffer data Tobias Johansson
2026-03-31 7:34 ` Claude Code Review Bot [this message]
2026-03-31 7:34 ` Claude review: drm/tiny: sharp-memory: fix TX buffer corruption on partial update Claude Code Review Bot
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-patch2-20260330-flickering-v1-2-5a192bf4b93d@axis.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