]> git.sur5r.net Git - u-boot/blobdiff - libfdt/fdt_ro.c
For fdt_find_node_by_path(), handle the root path properly.
[u-boot] / libfdt / fdt_ro.c
index 923c389ece9e3861902eb905ef60c14f567b17ab..ffd9209b1933971cfdefbb4f5ed4719a02049fa9 100644 (file)
@@ -283,6 +283,10 @@ int fdt_find_node_by_path(const void *fdt, const char *path)
        if (*path != '/')
                return -FDT_ERR_BADPATH;
 
+       /* Handle the root path: root offset is 0 */
+       if (strcmp(path, "/") == 0)
+               return 0;
+
        while (*p) {
                const char *q;