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: drm/xe/i2c: use platform_device_add_software_node()
Date: Sat, 16 May 2026 13:28:30 +1000	[thread overview]
Message-ID: <review-patch4-20260512-swnode-remove-on-dev-unreg-v5-4-0035eff63812@oss.qualcomm.com> (raw)
In-Reply-To: <20260512-swnode-remove-on-dev-unreg-v5-4-0035eff63812@oss.qualcomm.com>

Patch Review

The static software node definition is clean:
```c
static const struct software_node xe_i2c_adapter_swnode = {
    .properties = xe_i2c_adapter_properties,
};
```

And the call to `platform_device_add_software_node()` is correct.

**Bug 1: Uninitialized variable `fwnode` assigned to `i2c->adapter_node`.**

The patch removes the assignment `fwnode = fwnode_create_software_node(...)` but leaves both the declaration `struct fwnode_handle *fwnode;` and the line:
```c
i2c->adapter_node = fwnode;
```

After the patch, `fwnode` is declared but never assigned, so `i2c->adapter_node` receives an uninitialized pointer. The compiler should warn about this.

**Bug 2: `xe_i2c_unregister_adapter()` is not updated.**

The current unregister function:
```c
static void xe_i2c_unregister_adapter(struct xe_i2c *i2c)
{
    platform_device_unregister(i2c->pdev);
    fwnode_remove_software_node(i2c->adapter_node);
}
```

After patch 5 adds `device_remove_software_node()` to the release callback, the swnode is freed during `platform_device_unregister()`. The subsequent `fwnode_remove_software_node(i2c->adapter_node)` would be a use-after-free (compounded by the uninitialized pointer from bug 1).

The fix should:
1. Remove the `struct fwnode_handle *fwnode;` declaration (now unused).
2. Remove the `i2c->adapter_node = fwnode;` line.
3. Update `xe_i2c_unregister_adapter()` to remove the `fwnode_remove_software_node()` call, since the release callback now handles cleanup.

If `i2c->adapter_node` is used elsewhere, it should be set to `software_node_fwnode(&xe_i2c_adapter_swnode)` instead.

---
Generated by Claude Code Patch Reviewer

  parent reply	other threads:[~2026-05-16  3:28 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-12 11:59 [PATCH v5 0/7] driver core: remove software node from platform devices on device release Bartosz Golaszewski
2026-05-12 11:59 ` [PATCH v5 1/7] platform/surface: gpe: use platform_device_register_full() Bartosz Golaszewski
2026-05-16  3:28   ` Claude review: " Claude Code Review Bot
2026-05-12 11:59 ` [PATCH v5 2/7] driver core: platform: make the swnode check stricter Bartosz Golaszewski
2026-05-16  3:28   ` Claude review: " Claude Code Review Bot
2026-05-12 11:59 ` [PATCH v5 3/7] driver core: platform: provide platform_device_add_software_node() Bartosz Golaszewski
2026-05-12 16:31   ` Danilo Krummrich
2026-05-12 18:15     ` Dmitry Torokhov
2026-05-13 11:55     ` Bartosz Golaszewski
2026-05-16  3:28   ` Claude review: " Claude Code Review Bot
2026-05-12 11:59 ` [PATCH v5 4/7] drm/xe/i2c: use platform_device_add_software_node() Bartosz Golaszewski
2026-05-12 16:24   ` Danilo Krummrich
2026-05-16  3:28   ` Claude Code Review Bot [this message]
2026-05-12 11:59 ` [PATCH v5 5/7] driver core: platform: remove software node on release() Bartosz Golaszewski
2026-05-16  3:28   ` Claude review: " Claude Code Review Bot
2026-05-12 11:59 ` [PATCH v5 6/7] kunit: provide kunit_software_node_register() Bartosz Golaszewski
2026-05-12 15:28   ` Andy Shevchenko
2026-05-16  3:28   ` Claude review: " Claude Code Review Bot
2026-05-12 11:59 ` [PATCH v5 7/7] driver core: platform: tests: add test cases for correct swnode removal Bartosz Golaszewski
2026-05-16  3:28   ` Claude review: " Claude Code Review Bot
2026-05-12 15:07 ` [PATCH v5 0/7] driver core: remove software node from platform devices on device release Danilo Krummrich
2026-05-16  3:28 ` 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-20260512-swnode-remove-on-dev-unreg-v5-4-0035eff63812@oss.qualcomm.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