From mboxrd@z Thu Jan 1 00:00:00 1970 From: Claude Code Review Bot 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 Message-ID: In-Reply-To: <20260410194141.275998-1-osama.abdelkader@gmail.com> References: <20260410194141.275998-1-osama.abdelkader@gmail.com> <20260410194141.275998-1-osama.abdelkader@gmail.com> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Patch Review **The bug is real.** Before this patch, lines 1462-1463 (post-patch numberi= ng) 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 adapt= er, 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 resour= ces need cleanup =E2=80=94 consistent with what this patch does on the erro= r path. **Minor nit =E2=80=94 commit message style.** The commit message body ("whe= n component_add fails in sti_hdmi_probe remove the drm bridge and put i2c a= dapter before return") is a run-on sentence. A slightly improved version: > When component_add() fails in sti_hdmi_probe(), the DRM bridge and I2C ad= apter 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 fi= x. --- Generated by Claude Code Patch Reviewer