[PATCH] Add null pointer check to of_find_property

Michael Ellerman michael at ellerman.id.au
Thu May 8 09:21:06 EST 2008


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 <timur at freescale.com>
> ---
> 
> 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)

:)

cheers

-- 
Michael Ellerman
OzLabs, IBM Australia Development Lab

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20080508/24d97c92/attachment.pgp>


More information about the Linuxppc-dev mailing list