From mboxrd@z Thu Jan 1 00:00:00 1970 From: Claude Code Review Bot To: dri-devel-reviews@example.com Subject: Claude review: platform/surface: gpe: use platform_device_register_full() Date: Sat, 16 May 2026 13:28:29 +1000 Message-ID: In-Reply-To: <20260512-swnode-remove-on-dev-unreg-v5-1-0035eff63812@oss.qualcomm.com> References: <20260512-swnode-remove-on-dev-unreg-v5-0-0035eff63812@oss.qualcomm.com> <20260512-swnode-remove-on-dev-unreg-v5-1-0035eff63812@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 The init path conversion is clean =E2=80=94 replacing manual `fwnode_create= _software_node()` + `platform_device_alloc()` + `platform_device_add()` wit= h a single `platform_device_register_full()` call via `.properties` is a ni= ce simplification. **Bug: `surface_gpe_exit()` is not updated and becomes a use-after-free.** The current exit function (unchanged by this patch) does: ```c static void __exit surface_gpe_exit(void) { struct fwnode_handle *fwnode =3D surface_gpe_device->dev.fwnode; platform_device_unregister(surface_gpe_device); platform_driver_unregister(&surface_gpe_driver); fwnode_remove_software_node(fwnode); } ``` After this patch, `.properties` in `pdevinfo` causes `platform_device_regis= ter_full()` to call `device_create_managed_software_node()`. A managed swno= de is automatically freed during `software_node_notify_remove()` (called fr= om `device_del()` inside `platform_device_unregister()`). At that point, `f= wnode` is a dangling pointer, and the subsequent `fwnode_remove_software_no= de(fwnode)` is a use-after-free. The exit function must be updated to remove the manual `fwnode_remove_softw= are_node()` call, since the managed node is cleaned up automatically by the= unregister path. Something like: ```c static void __exit surface_gpe_exit(void) { platform_device_unregister(surface_gpe_device); platform_driver_unregister(&surface_gpe_driver); } ``` --- Generated by Claude Code Patch Reviewer