From mboxrd@z Thu Jan 1 00:00:00 1970 From: Claude Code Review Bot To: dri-devel-reviews@example.com Subject: Claude review: driver core: platform: unify release path Date: Sat, 16 May 2026 11:52:20 +1000 Message-ID: In-Reply-To: <20260513-swnode-remove-on-dev-unreg-v6-4-f9c58939df27@oss.qualcomm.com> References: <20260513-swnode-remove-on-dev-unreg-v6-0-f9c58939df27@oss.qualcomm.com> <20260513-swnode-remove-on-dev-unreg-v6-4-f9c58939df27@oss.qualcomm.com> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 Patch Review **Correct, with careful refcount handling.** This moves `device_remove_software_node()` into the base `platform_device_release()` and removes the separate `platform_device_release_full()` introduced in patch 1. The key subtlety is the `fwnode_handle_get()` for software nodes passed as primary fwnode: ```c if (is_software_node(pdevinfo->fwnode)) fwnode_handle_get(pdevinfo->fwnode); ``` This is necessary because `device_remove_software_node()` in the release path calls `kobject_put()` on whatever software node it finds. If the primary fwnode IS a software node (user-owned, not created by the platform code), the put would steal a reference the caller still holds. The extra get counterbalances this. The placement before `platform_device_add_resources()` is correct: if any subsequent operation fails and we fall through to `err:`, `platform_device_put()` triggers the release callback, which calls `device_remove_software_node()`, which will consume the extra reference. Balanced. The three cases work out: - **Primary is software node, no secondary**: Extra get protects caller's reference; release puts it back. - **Primary is non-swnode, secondary via pdevinfo->swnode**: No extra get needed; `device_remove_software_node()` removes the secondary swnode (added by this code). - **Properties (managed secondary)**: Managed node is already cleaned by `software_node_notify_remove()` during `device_del()`; by the time `platform_device_release()` runs, `dev_to_swnode()` returns NULL, so `device_remove_software_node()` is a no-op. **Verdict**: Correct. --- --- Generated by Claude Code Patch Reviewer