From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: drm/msm: fbdev: Use a DRM client buffer
Date: Thu, 23 Apr 2026 08:30:53 +1000 [thread overview]
Message-ID: <review-patch5-20260421125733.209568-6-tzimmermann@suse.de> (raw)
In-Reply-To: <20260421125733.209568-6-tzimmermann@suse.de>
Patch Review
**Status: Bug in error handling.**
The core conversion to use `drm_client_buffer_create()` and `drm_client_buffer_delete()` is correct in concept. The success path reference counting is sound:
1. `msm_gem_new()` → refcount = 1
2. `drm_gem_handle_create(file, bo, &handle)` → refcount = 2
3. `drm_client_buffer_create()` (internally looks up handle, fb takes ref) → refcount = 3
4. `drm_gem_handle_delete(file, handle)` → refcount = 2
5. `drm_gem_object_put(bo)` → refcount = 1 (only the framebuffer holds a reference)
The destroy path in `msm_fbdev_fb_destroy()` is also correct: `msm_gem_put_vaddr()` releases the mapping, then `drm_client_buffer_delete()` removes the framebuffer (dropping the last GEM reference).
**Bug:** The error goto when `msm_gem_get_vaddr()` fails is wrong:
```c
fbi->screen_buffer = msm_gem_get_vaddr(bo);
if (IS_ERR(fbi->screen_buffer)) {
ret = PTR_ERR(fbi->screen_buffer);
goto err_msm_gem_put_vaddr; // BUG: vaddr was never acquired
}
```
Looking at `get_vaddr()` in `msm_gem.c:708`, when it fails it cleans up internally (decrements `vmap_count`, unpins). Calling `msm_gem_put_vaddr()` after a failed `msm_gem_get_vaddr()` would decrement `vmap_count` below its correct value, triggering:
```c
GEM_WARN_ON(msm_obj->vmap_count < 1); // msm_gem.c:782
```
**The fix:** This goto should be `goto err_drm_client_buffer_delete;` instead.
---
Generated by Claude Code Patch Reviewer
next prev parent reply other threads:[~2026-04-22 22:30 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-21 12:51 [PATCH 0/6] drm/msm: fbdev: Use client buffers Thomas Zimmermann
2026-04-21 12:51 ` [PATCH 1/6] drm/msm: Do not declare msm_framebuffer_init() as static Thomas Zimmermann
2026-04-21 16:09 ` Dmitry Baryshkov
2026-04-22 22:30 ` Claude review: " Claude Code Review Bot
2026-04-21 12:51 ` [PATCH 2/6] drm/msm: fbdev: Inline msm_alloc_stolen_fb() Thomas Zimmermann
2026-04-21 16:22 ` Dmitry Baryshkov
2026-04-22 22:30 ` Claude review: " Claude Code Review Bot
2026-04-21 12:51 ` [PATCH 3/6] drm/msm: fbdev: Fix error reporting Thomas Zimmermann
2026-04-21 16:22 ` Dmitry Baryshkov
2026-04-22 22:30 ` Claude review: " Claude Code Review Bot
2026-04-21 12:51 ` [PATCH 4/6] drm/msm: fbdev: Calculate buffer geometry with format helpers Thomas Zimmermann
2026-04-22 0:07 ` Dmitry Baryshkov
2026-04-22 22:30 ` Claude review: " Claude Code Review Bot
2026-04-21 12:51 ` [PATCH 5/6] drm/msm: fbdev: Use a DRM client buffer Thomas Zimmermann
2026-04-22 0:13 ` Dmitry Baryshkov
2026-04-22 22:30 ` Claude Code Review Bot [this message]
2026-04-21 12:51 ` [PATCH 6/6] drm/msm: Make msm_framebuffer_init() an internal interface again Thomas Zimmermann
2026-04-22 0:13 ` Dmitry Baryshkov
2026-04-22 22:30 ` Claude review: " Claude Code Review Bot
2026-04-21 16:08 ` [PATCH 0/6] drm/msm: fbdev: Use client buffers Dmitry Baryshkov
2026-04-22 0:14 ` Dmitry Baryshkov
2026-04-22 22:30 ` Claude review: " 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-patch5-20260421125733.209568-6-tzimmermann@suse.de \
--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