[PATCH 06/18] Make ft_node_add() accept and return NULL.

Segher Boessenkool segher at kernel.crashing.org
Thu Jan 25 09:30:53 EST 2007


>>> Currently, if ft_node_add() is passed NULL it will allocate an   
>>> entry for
>>> it and return a non-NULL phandle.  This patch makes it simply  
>>> pass the
>>> NULL through.
>> Hrm, is this a good thing?  Shouldn't you just BUG_ON()
>> instead?
>
> There are times where NULL is normal -- such as at the end of an  
> iteration to find every instance of a certain type of node, or to  
> follow parentage to the root node.  Having ft_node_add() pass the  
> NULL through keeps it from being a special case in all of the  
> wrapper code that turns the internal node into a phandle before  
> returning.

But doesn't ft_add_node() add a node to the tree?  If so,
a NULL is most likely a program error. If not, some name
change is in order /me thinks ;-)


Segher




More information about the Linuxppc-dev mailing list