# Re: dtc: Return code of fdt\_get\_path()

- From: David Gibson \<hidden\>
- Date: 2008-08-06 05:33:10 
- List: linux-devicetree
- Page: https://ratatoskr.run/linux-devicetree/2008/08/8049080
- Thread: https://ratatoskr.run/linux-devicetree/2008/08/8049080/t.md

```text
On Tue, Aug 05, 2008 at 04:12:22PM -0500, Scott Wood wrote:
> The documentation for fdt_get_path() says it returns zero on success,  
> but it actually returns the length of the string.  Is there any  
> preference on which one to fix?

The documentation I think.  There may be existing users, and the
length of the path is potentially useful.

Although.. I think the confusion came because at one stage I planned
to have it return the full length of the path, even if the buffer was
smaller.  That would let the caller allocate a buffer of exactly the
right size on a second call.  Which is potentially useful, but not
compatible with returning NOSPACE as we do now.

Plus.. looking over that code again, I think there may be more
problems there - I think there may be cases where it runs out of space
but returns BADOFFSET or some error code instead of NOSPACE.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
```
