From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: drm/sti: hdmi: remove bridge when component_add fails
Date: Sun, 12 Apr 2026 09:29:49 +1000 [thread overview]
Message-ID: <review-patch1-20260410194141.275998-1-osama.abdelkader@gmail.com> (raw)
In-Reply-To: <20260410194141.275998-1-osama.abdelkader@gmail.com>
Patch Review
**The bug is real.** Before this patch, lines 1462-1463 (post-patch numbering) were:
```c
drm_bridge_add(&hdmi->bridge);
return component_add(&pdev->dev, &sti_hdmi_ops);
```
If `component_add()` fails, execution returns directly with the error code, leaking both the `drm_bridge_add()` registration and the `i2c_put_adapter()` reference acquired at line 1392.
**The fix is correct.** The new `remove_bridge` label is placed between the `return 0` and the existing `release_adapter` label, so it properly falls through to also call `i2c_put_adapter()`:
```c
remove_bridge:
drm_bridge_remove(&hdmi->bridge);
release_adapter:
i2c_put_adapter(hdmi->ddc_adapt);
```
This matches the reverse order of acquisition (`drm_bridge_add` after adapter, so `drm_bridge_remove` before `i2c_put_adapter`).
**Consistency with `sti_hdmi_remove()`.** The remove function at line 1476 calls `drm_bridge_remove()` and `i2c_put_adapter()`, confirming both resources need cleanup — consistent with what this patch does on the error path.
**Minor nit — commit message style.** The commit message body ("when component_add fails in sti_hdmi_probe remove the drm bridge and put i2c adapter before return") is a run-on sentence. A slightly improved version:
> When component_add() fails in sti_hdmi_probe(), the DRM bridge and I2C adapter reference are leaked. Add a cleanup path to call drm_bridge_remove() and i2c_put_adapter() on failure.
This is a style-only suggestion and shouldn't block the patch.
**Reviewed-by worthy:** Yes. The logic is sound, the error unwind order is correct, and the fix is minimal. This is a straightforward resource-leak fix.
---
Generated by Claude Code Patch Reviewer
next prev parent reply other threads:[~2026-04-11 23:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-10 19:41 [PATCH] drm/sti: hdmi: remove bridge when component_add fails Osama Abdelkader
2026-04-11 23:29 ` Claude Code Review Bot [this message]
2026-04-11 23: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-patch1-20260410194141.275998-1-osama.abdelkader@gmail.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