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/mipi-dsi: fix of_node reference leak in of_mipi_dsi_device_add error path Date: Mon, 25 May 2026 16:47:47 +1000 Message-ID: In-Reply-To: <20260525045028.3895931-1-vulab@iscas.ac.cn> References: <20260525045028.3895931-1-vulab@iscas.ac.cn> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Overall Series Review Subject: drm/mipi-dsi: fix of_node reference leak in of_mipi_dsi_device_add= error path Author: Wentao Liang Patches: 1 Reviewed: 2026-05-25T16:47:47.286637 --- This is a single-patch fix for a real `of_node` reference leak in `of_mipi_= dsi_device_add()`. The analysis is correct: when `mipi_dsi_device_register_= full()` fails, the reference acquired by `of_node_get(node)` at line 182 is= never released. There are **two** failure paths inside `mipi_dsi_device_register_full()` th= at can leak: 1. **Early parameter validation failures** (lines 215-223): `info->node` is= never stored into a device, so the ref is simply orphaned. 2. **`mipi_dsi_device_add()` failure** (lines 237-240): The allocated `dsi`= is freed with `kfree(dsi)` rather than `put_device(&dsi->dev)`, so the `.r= elease` callback (`mipi_dsi_dev_release`, which does `of_node_put`) is neve= r invoked. The fix is correct and minimal. However, there is a secondary bug worth not= ing: the `kfree(dsi)` at line 239 in `mipi_dsi_device_register_full` is its= elf a bug =E2=80=94 after `device_initialize()` has been called (in `mipi_d= si_device_alloc`), the device must be freed via `put_device()`, not `kfree(= )`. Using `kfree` after `device_initialize` can lead to issues if anything = has taken a reference on the device. That's a pre-existing issue outside th= e scope of this patch, but it means the `of_node_put` in the release callba= ck can never fire on this error path anyway, reinforcing that the caller-si= de fix is necessary. **Verdict: The patch is correct and should be applied.** One minor style ni= t below. --- Generated by Claude Code Patch Reviewer