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: count references to all kinds of firmware nodes Date: Mon, 25 May 2026 20:33:08 +1000 Message-ID: In-Reply-To: <20260521-pdev-fwnode-ref-v1-23-88c324a1b8d2@oss.qualcomm.com> References: <20260521-pdev-fwnode-ref-v1-0-88c324a1b8d2@oss.qualcomm.com> <20260521-pdev-fwnode-ref-v1-23-88c324a1b8d2@oss.qualcomm.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 This is the payoff patch. Three key changes: **Release function**: ```c - of_node_put(pa->pdev.dev.of_node); + fwnode_handle_put(pa->pdev.dev.fwnode); ``` Correct. For OF nodes, `fwnode_handle_put()` calls through to `of_node_put(= )` via the fwnode ops. For non-OF fwnodes, this now properly drops the refe= rence that patch 23's updated helpers take. **`platform_device_set_fwnode()` becomes the canonical implementation**: ```c void platform_device_set_fwnode(struct platform_device *pdev, struct fwnode_handle *fwnode) { - if (is_of_node(fwnode)) - platform_device_set_of_node(pdev, to_of_node(fwnode)); - else - pdev->dev.fwnode =3D fwnode; + fwnode_handle_put(pdev->dev.fwnode); + pdev->dev.fwnode =3D fwnode_handle_get(fwnode); + pdev->dev.of_node =3D to_of_node(fwnode); } ``` Clean. Unified get/put for all fwnode types. `to_of_node()` returns NULL fo= r non-OF fwnodes, correctly clearing `of_node`. **`platform_device_set_of_node()` becomes a thin wrapper**: ```c void platform_device_set_of_node(struct platform_device *pdev, struct device_node *np) { - of_node_put(pdev->dev.of_node); - pdev->dev.of_node =3D of_node_get(np); - pdev->dev.fwnode =3D of_fwnode_handle(np); + platform_device_set_fwnode(pdev, of_fwnode_handle(np)); } ``` Correct inversion of the delegation =E2=80=94 `set_of_node` now calls `set_= fwnode` instead of the reverse. **`platform_device_register_full()`**: ```c - pdev->dev.fwnode =3D pdevinfo->fwnode; - pdev->dev.of_node =3D of_node_get(to_of_node(pdev->dev.fwnode)); + pdev->dev.fwnode =3D fwnode_handle_get(pdevinfo->fwnode); + pdev->dev.of_node =3D to_of_node(pdev->dev.fwnode); ``` Correct. Takes a generic fwnode ref instead of only an OF ref. The `dev_ass= ign_of_node_reused` call on the next line is not in the current tree =E2=80= =94 this needs a dependency note. **Overall**: The refcounting is balanced. Every `fwnode_handle_get()` in th= e set functions is matched by the `fwnode_handle_put()` in `platform_device= _release()`. The `platform_device_set_of_node_from_dev()` path works becaus= e for OF nodes, `of_node_get()` and `fwnode_handle_put()` operate on the sa= me underlying refcount. --- Generated by Claude Code Patch Reviewer