mirror of
https://github.com/dgibson/dtc.git
synced 2025-12-07 05:35:07 -05:00
pylibfdt: Return string instead of bytearray from getprop()
The return value is not actually mutable, so it seems more correct to return bytes rather than a bytearray. Suggested-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
4d09a83420
commit
64a69d1239
1 changed files with 3 additions and 2 deletions
|
|
@ -365,7 +365,7 @@ class Fdt:
|
||||||
quiet: Errors to ignore (empty to raise on all errors)
|
quiet: Errors to ignore (empty to raise on all errors)
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
Value of property as a bytearray, or -ve error number
|
Value of property as a string of bytes, or -ve error number
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
FdtError if any error occurs (e.g. the property is not found)
|
FdtError if any error occurs (e.g. the property is not found)
|
||||||
|
|
@ -374,7 +374,8 @@ class Fdt:
|
||||||
quiet)
|
quiet)
|
||||||
if isinstance(pdata, (int)):
|
if isinstance(pdata, (int)):
|
||||||
return pdata
|
return pdata
|
||||||
return bytearray(pdata[0])
|
# Use bytes() rather than string(). This works on both Python 2 and 3
|
||||||
|
return bytes(pdata[0])
|
||||||
|
|
||||||
def get_phandle(self, nodeoffset):
|
def get_phandle(self, nodeoffset):
|
||||||
"""Get the phandle of a node
|
"""Get the phandle of a node
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue