Re: [PATCH] software node: make swnodes hold their own references on parents

From: Johan Hovold

Date: Tue Nov 17 2026 - 08:47:12 EST


On Tue, Nov 17, 2026 at 02:39:27PM +0100, Bartosz Golaszewski wrote:
> On Tue, Nov 17, 2026 at 01:10:02PM +0100, Johan Hovold wrote:
> > On Fri, Nov 06, 2026 at 12:13:28PM +0100, Bartosz Golaszewski wrote:

> > > @@ -843,11 +843,12 @@ static void software_node_free(const struct software_node *node)
> > > static void software_node_release(struct kobject *kobj)
> > > {
> > > struct swnode *swnode = kobj_to_swnode(kobj);
> > > + struct swnode *parent = swnode->parent;
> > >
> > > fwnode_links_purge(&swnode->fwnode);
> > >
> > > - if (swnode->parent) {
> > > - ida_free(&swnode->parent->child_ids, swnode->id);
> > > + if (parent) {
> > > + ida_free(&parent->child_ids, swnode->id);
> > > list_del(&swnode->entry);
> >
> > Why not simply
> >
> > swnode_put(swnode->parent);
> >
> > here?
> >
>
> Because swnode_put() doesn't accept NULL. I have it on my TODO list to
> add it but this is a fix, so I want to keep it minimal.

swnode->parent is not NULL here in the conditional block.

Johan