Is get_property() correct?

Benjamin Herrenschmidt benh at kernel.crashing.org
Sat Oct 28 17:23:55 EST 2006


On Sat, 2006-10-28 at 00:41 -0600, Grant Likely wrote:
> Is the implementation of get_property correct?  The comment says it
> returns the value of a property; but the return statement just returns
> the property pointer (cast as void*) it got from of_find_property();
> not the value.
> 
> Does the comment or the code need to change?

Well considering that we don't know the type of the property value, the
best we can do is return a pointer to it ... 

The comment might want an update, though it never stroke me as confusing
but heh :)

> in prom.c:
> 
> /*
>  * Find a property with a given name for a given node
>  * and return the value.
>  */
> const void *get_property(const struct device_node *np, const char *name,
>                          int *lenp)
> {
>         struct property *pp = of_find_property(np,name,lenp);
>         return pp ? pp->value : NULL;
> }
> EXPORT_SYMBOL(get_property);
> 
> Cheers,
> g.
> 




More information about the Linuxppc-dev mailing list