Re: [PATCH 1/2] driver core: platform: remove software node on release()

Dmitry Torokhov
2026-04-13T03:56:27Z

Hi Bartosz,

On Fri, Apr 10, 2026 at 01:50:45PM +0200, Bartosz Golaszewski wrote:
> If we pass a software node to a newly created device using struct
> platform_device_info, it will not be removed when the device is
> released. This may happen when a module creating the device is removed
> or on failure in platform_device_add().
>
> When we try to reuse that software node in a subsequent call to
> platform_device_register_full(), it will fails with -EBUSY. Add the
> missing call to device_remove_software_node() in release path.

Thank you for spotting this, but I do not believe the patch is correct
as it stands. We need to differentiate between nodes registered by
platform devices vs nodes that already registered where we simply use
them.

I think we need to mark nodes that platform_device_register_full()
registers form swnodes as "managed = true" so that they are cleaned up
properly.

See also sashiko feedback.

https://sashiko.dev/#/patchset/20260410-swnode-remove-on-dev-unreg-v1-0-cd7d305f3db2%40oss.qualcomm.com

Thanks.

--
Dmitry