Claude review: gpu: host1x: Fix device reference leak in host1x_device_parse_dt() error path

Claude Code Review Bot
2026-04-13T09:07:35Z

Overall Series Review

Subject: gpu: host1x: Fix device reference leak in host1x_device_parse_dt() error path
Author: Guangshuo Li <lgs201920130244@gmail.com>
Patches: 1
Reviewed: 2026-04-13T19:07:35.144042

---

This is a single-patch series that fixes a legitimate device reference leak in the host1x driver. The analysis is correct: after `device_initialize()` is called, the proper way to free the device is through `put_device()`, not `kfree()`. The fix itself is sound — `put_device()` will invoke `host1x_device_release()`, which calls `__host1x_device_del()` and then `kfree()`.

The release path is safe in this context: `__host1x_device_del()` iterates `device->active` (empty at this point since no clients have been registered), `device->subdevs` (may contain entries added by `host1x_device_parse_dt()` before it failed — these get properly cleaned up via `host1x_subdev_del()`), `device->clients` (empty), and calls `list_del_init(&device->list)` (safe since `INIT_LIST_HEAD` was called). So `put_device()` correctly tears down any partial state that `host1x_device_parse_dt()` may have built up.

**Verdict: The patch is correct and suitable for merging.**