From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: drm/vmwgfx: Add some checks to vmw_cursor_plane_atomic_update
Date: Sat, 16 May 2026 14:26:30 +1000 [thread overview]
Message-ID: <review-patch1-20260512002752.2826685-2-maaz.mombasawala@broadcom.com> (raw)
In-Reply-To: <20260512002752.2826685-2-maaz.mombasawala@broadcom.com>
Patch Review
**C99 mixed declarations issue.** The patch adds early-return guards for null `new_state` and `old_state`, which is correct defensively, but introduces a variable declaration after a statement, which is problematic for kernel coding style:
```c
new_state = drm_atomic_get_new_plane_state(state, plane);
if (!new_state)
return;
old_state = drm_atomic_get_old_plane_state(state, plane);
struct drm_crtc *crtc = new_state->crtc ? new_state->crtc :
(old_state ? old_state->crtc : NULL);
```
The `struct drm_crtc *crtc` declaration appears after the `if (!new_state) return;` statement. While C99/C11 allows this, mixing declarations and statements like this after control flow is poor style. `crtc` should be declared at the top of the function alongside the other variables, and assigned later.
**Questionable whether `new_state` can actually be NULL.** In the atomic commit path, `drm_atomic_get_new_plane_state` should always return a valid state for a plane that is part of the atomic update. If this function is being called, the plane was part of the commit. If the null dereference in the IGT test is real, it might indicate a deeper issue worth investigating rather than just papering over with null checks. That said, defensive programming here is not unreasonable as a crash fix.
**The `old_state` null handling is good.** Guarding `old_state->crtc` with `old_state ? old_state->crtc : NULL` is the right fix for the originally reported null dereference — on first enable there may be no old state, and the `?:` operator unconditionally dereferences `old_state`.
---
Generated by Claude Code Patch Reviewer
next prev parent reply other threads:[~2026-05-16 4:26 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-12 0:27 [PATCH v2 0/5] Fix some issues from igt runs Maaz Mombasawala
2026-05-12 0:27 ` [PATCH v2 1/5] drm/vmwgfx: Add some checks to vmw_cursor_plane_atomic_update Maaz Mombasawala
2026-05-16 4:26 ` Claude Code Review Bot [this message]
2026-05-12 0:27 ` [PATCH v2 2/5] drm/vmwgfx: Check vrefresh in drm_mode_setcrtc Maaz Mombasawala
2026-05-16 4:26 ` Claude review: " Claude Code Review Bot
2026-05-12 0:27 ` [PATCH v2 3/5] drm/vmwgfx: Reserve ttm object before resv usage Maaz Mombasawala
2026-05-16 4:26 ` Claude review: " Claude Code Review Bot
2026-05-12 0:27 ` [PATCH v2 4/5] drm/vmwgfx: Change ttm refs for dumb buffers Maaz Mombasawala
2026-05-16 4:26 ` Claude review: " Claude Code Review Bot
2026-05-12 0:27 ` [PATCH v2 5/5] drm/vmwgfx: Remove duplicates in vmwgfx_bo.h Maaz Mombasawala
2026-05-16 4:26 ` Claude review: " Claude Code Review Bot
2026-05-16 4:26 ` Claude review: Fix some issues from igt runs Claude Code Review Bot
-- strict thread matches above, loose matches on Subject: below --
2026-05-14 22:48 [PATCH v3 0/5] " Maaz Mombasawala
2026-05-14 22:48 ` [PATCH v3 1/5] drm/vmwgfx: Add some checks to vmw_cursor_plane_atomic_update Maaz Mombasawala
2026-05-16 0:17 ` Claude review: " Claude Code Review Bot
2026-03-20 1:49 [PATCH] " Maaz Mombasawala
2026-03-21 17:57 ` Claude review: " Claude Code Review Bot
2026-03-21 17:57 ` 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-patch1-20260512002752.2826685-2-maaz.mombasawala@broadcom.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