Michael Ellerman writes:

> On Wed, 2008-05-07 at 14:19 -0500, Timur Tabi wrote:
> > Update function of_find_property() to return NULL if the device_node passed
> > to it is also NULL.  Otherwise, passing NULL will cause a null pointer
> > dereference.
> > 
> > Signed-off-by: Timur Tabi <[EMAIL PROTECTED]>
> > ---
> > 
> > This patch allows callers to do this:
> 
> np = of_find_compatible_node(...);
> prop = of_get_property(np);
> if (!prop)
>      goto error;
> 
> ...
> 
> error:
>  of_node_put(np)
> 
> :)

And of_node_put looks like this:

void of_node_put(struct device_node *node)
{
        if (node)
                kref_put(&node->kref, of_node_release);
}

so it's OK.

:)

Paul.
_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

Reply via email to