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/radeon/radeon_connectors: use struct drm_edid instead of struct edid
Date: Mon, 25 May 2026 17:37:44 +1000	[thread overview]
Message-ID: <review-patch1-20260523142748.50034-2-jpeisach@ubuntu.com> (raw)
In-Reply-To: <20260523142748.50034-2-jpeisach@ubuntu.com>

Patch Review

**Positive aspects:**
- The field type change in `radeon_mode.h` from `struct edid *edid` to `const struct drm_edid *edid` is correct and matches the return type of `drm_edid_read_ddc()` / `drm_edid_read_switcheroo()`.
- The `drm_edid_connector_update()` + `drm_edid_connector_add_modes()` replacement is the correct modern pattern.
- The `drm_edid_is_digital()` replacement for `!!(radeon_connector->edid->input & DRM_EDID_INPUT_DIGITAL)` is correct — `drm_edid_is_digital()` takes `const struct drm_edid *`.
- The `radeon_bios_get_hardcoded_edid()` change from `drm_edid_duplicate(drm_edid_raw(...))` to `drm_edid_dup(...)` is a clean simplification.

**Issue 1 — `radeon_connector_free_edid` left using `kfree` on `struct drm_edid`:**

After patch 1, the field type changes to `const struct drm_edid *`, but `radeon_connector_free_edid()` still calls `kfree()` on it:

```c
static void radeon_connector_free_edid(struct drm_connector *connector)
{
	struct radeon_connector *radeon_connector = to_radeon_connector(connector);

	kfree(radeon_connector->edid);
	radeon_connector->edid = NULL;
}
```

After patch 1, `radeon_connector->edid` is now a `const struct drm_edid *`, but `kfree()` is still used instead of `drm_edid_free()`. This is a **correctness bug between patches** — `struct drm_edid` is allocated by the `drm_edid_read_*` functions and contains an internal `const struct edid *edid` pointer that also needs freeing. Simply calling `kfree()` on the outer `struct drm_edid` will leak the inner EDID data. The tree must compile and be correct at every patch boundary, so patch 1 should update `radeon_connector_free_edid` to call `drm_edid_free()` or the two patches should be squashed.

Additionally, `kfree()` on a `const` pointer will generate a compiler warning/error about discarding the `const` qualifier.

**Issue 2 — `drm_edid_to_sad` / `drm_edid_to_speaker_allocation` take `const struct edid *`:**

The audio code changes are correct. These functions take `const struct edid *`, so using `drm_edid_raw()` to extract the raw EDID is the right approach:

```c
sad_count = drm_edid_to_sad(drm_edid_raw(radeon_connector->edid), &sads);
sad_count = drm_edid_to_speaker_allocation(drm_edid_raw(radeon_connector->edid), &sadb);
```

No issue here, just confirming it's correct.

**Issue 3 — `drm_edid_connector_update` return value ignored:**

In `radeon_ddc_get_modes`, the return value of `drm_edid_connector_update()` is silently discarded:

```c
	if (radeon_connector->edid) {
		drm_edid_connector_update(connector, radeon_connector->edid);
		ret = drm_edid_connector_add_modes(connector);
		return ret;
	}
	drm_edid_connector_update(connector, NULL);
```

The old `drm_connector_update_edid_property()` also returned int and was also ignored, so this is pre-existing behavior and not a regression. Just noting it.

**Nit — `drm_edid_read_ddc` vs `drm_edid_read`:**

For the non-DP, non-switcheroo, plain i2c adapter case, `drm_edid_read()` could be used instead of `drm_edid_read_ddc()` since `drm_edid_read()` is just `drm_edid_read_ddc(connector, connector->ddc)`. However, radeon sets the ddc_bus separately from the connector's `ddc` field, so using `drm_edid_read_ddc` with the explicit adapter is correct here.

---

---
Generated by Claude Code Patch Reviewer

  parent reply	other threads:[~2026-05-25  7:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-23 14:27 [PATCH NEXT 0/2] drm/radeon/radeon_connectors: use struct drm_edid Joshua Peisach
2026-05-23 14:27 ` [PATCH NEXT 1/2] drm/radeon/radeon_connectors: use struct drm_edid instead of struct edid Joshua Peisach
2026-05-23 14:39   ` Joshua Peisach
2026-05-25  7:37   ` Claude Code Review Bot [this message]
2026-05-23 14:27 ` [PATCH NEXT 2/2] drm/radeon/radeon_connectors: remove radeon_connector_free_edid Joshua Peisach
2026-05-25  7:37   ` Claude review: " Claude Code Review Bot
2026-05-25  7:37 ` Claude review: drm/radeon/radeon_connectors: use struct drm_edid 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-20260523142748.50034-2-jpeisach@ubuntu.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