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: fbdev: defio: Move pageref array to struct fb_deferred_io_state
Date: Fri, 27 Feb 2026 15:29:26 +1000	[thread overview]
Message-ID: <review-patch4-20260224082657.207284-5-tzimmermann@suse.de> (raw)
In-Reply-To: <20260224082657.207284-5-tzimmermann@suse.de>

Patch Review

Moves `npagerefs` and `pagerefs` from `struct fb_info` to `struct fb_deferred_io_state`, further reducing driver-visible state.

`fb_deferred_io_state_alloc` now takes a `len` parameter:

```c
static struct fb_deferred_io_state *fb_deferred_io_state_alloc(unsigned long len)
{
	struct fb_deferred_io_state *fbdefio_state;
	struct fb_deferred_io_pageref *pagerefs;
	unsigned long npagerefs;

	fbdefio_state = kzalloc_obj(*fbdefio_state);
	if (!fbdefio_state)
		return NULL;

	npagerefs = DIV_ROUND_UP(len, PAGE_SIZE);

	pagerefs = kvzalloc_objs(*pagerefs, npagerefs);
	if (!pagerefs)
		goto err_kfree;
	fbdefio_state->npagerefs = npagerefs;
	fbdefio_state->pagerefs = pagerefs;

	kref_init(&fbdefio_state->ref);
	mutex_init(&fbdefio_state->lock);

	INIT_LIST_HEAD(&fbdefio_state->pagereflist);

	return fbdefio_state;

err_kfree:
	kfree(fbdefio_state);
	return NULL;
}
```

The error path is correct: `kref_init` and `mutex_init` haven't been called yet at the `err_kfree` label, so a plain `kfree` is sufficient. The `kvfree(fbdefio_state->pagerefs)` is properly placed in `fb_deferred_io_state_release`.

The change to `fb_deferred_io_pageref_lookup` signature:

```c
static struct fb_deferred_io_pageref *
fb_deferred_io_pageref_lookup(struct fb_deferred_io_state *fbdefio_state,
                              unsigned long offset, struct page *page)
{
	struct fb_info *info = fbdefio_state->info;
```

This is safe because all callers hold `fbdefio_state->lock` and have verified `info != NULL`.

The simplification of `fb_deferred_io_init` is a nice cleanup — the separate `err:` label and `ret` variable are no longer needed since the allocation is fully encapsulated in `fb_deferred_io_state_alloc`.

No issues with this patch.

---
Generated by Claude Code Patch Reviewer

  reply	other threads:[~2026-02-27  5:29 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-24  8:25 [PATCH v2 0/4] fbdev: defio: Protect against device/module removal Thomas Zimmermann
2026-02-24  8:25 ` [PATCH v2 1/4] fbdev: defio: Disconnect deferred I/O from the lifetime of struct fb_info Thomas Zimmermann
2026-02-27  5:29   ` Claude review: " Claude Code Review Bot
2026-02-24  8:25 ` [PATCH v2 2/4] fbdev: defio: Keep module reference from VMAs Thomas Zimmermann
2026-02-27  5:29   ` Claude review: " Claude Code Review Bot
2026-02-24  8:25 ` [PATCH v2 3/4] fbdev: defio: Move variable state into struct fb_deferred_io_state Thomas Zimmermann
2026-02-27  5:29   ` Claude review: " Claude Code Review Bot
2026-02-24  8:25 ` [PATCH v2 4/4] fbdev: defio: Move pageref array to " Thomas Zimmermann
2026-02-27  5:29   ` Claude Code Review Bot [this message]
2026-02-24 22:02 ` [PATCH v2 0/4] fbdev: defio: Protect against device/module removal Helge Deller
2026-02-27  5:29 ` 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-patch4-20260224082657.207284-5-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