mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-11 07:34:31 +00:00
dm: core: Fix offset_to_ofnode() with invalid offset
If the offset is -1 this function correctly sets up a null ofnode. But if the offset is any other negative number (e.g. -FDT_ERR_BADPATH) then it does the wrong thing. An offset of -1 in ofnode indicates that the ofnode is not valid. Any other negative value is not handled by ofnode_valid(). We could of course change that function, but it seems much better to always use the same value for an invalid node. Fix it by setting the offset to -1 if it is invalid for any reason. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
This commit is contained in:
parent
bcee8d6764
commit
b14c533986
1 changed files with 1 additions and 1 deletions
|
@ -118,7 +118,7 @@ static inline ofnode offset_to_ofnode(int of_offset)
|
|||
if (of_live_active())
|
||||
node.np = NULL;
|
||||
else
|
||||
node.of_offset = of_offset;
|
||||
node.of_offset = of_offset >= 0 ? of_offset : -1;
|
||||
|
||||
return node;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue