On Thu, Apr 23, 2026 at 7:32 PM Dmitry Torokhov <[email protected]> wrote: > > > > > + /* > > + * If the primary firmware node is a software node and there's no > > + * secondary firmware node, the primary will be affected by the call > > + * to device_remove_software_node() in platform_device_release() and > > + * its reference count will be dropped by one. Take another reference > > + * here to make it have no effect. > > + */ > > + if (is_software_node(pdevinfo->fwnode) && !pdevinfo->swnode) > > + fwnode_handle_get(pdevinfo->fwnode); > > It is possible to pass already registered node in pdevinfo->swnode > (because device_add_software_node() can handle this just fine). In this > case we also need to take an extra reference (or figure out whether we > need to drop the reference when removing the device). >
But device_add_software_node() checks if the software node is registered and - if so - just bumps the reference so the effect is the same as when it registers the swnode. Bart

