]> git.sur5r.net Git - u-boot/blobdiff - lib/libfdt/fdt_ro.c
riscv: Modify generic codes to support RISC-V
[u-boot] / lib / libfdt / fdt_ro.c
index e38aaa4ccf9ace9f3544a291180dcc359f9ebedb..1be9538fd277fc2c78dd630619241a232f79b459 100644 (file)
@@ -204,6 +204,11 @@ int fdt_path_offset_namelen(const void *fdt, const char *path, int namelen)
        return offset;
 }
 
+int fdt_path_offset(const void *fdt, const char *path)
+{
+       return fdt_path_offset_namelen(fdt, path, strlen(path));
+}
+
 const char *fdt_get_name(const void *fdt, int nodeoffset, int *len)
 {
        const struct fdt_node_header *nh = _fdt_offset_ptr(fdt, nodeoffset);
@@ -545,7 +550,7 @@ int fdt_stringlist_count(const void *fdt, int nodeoffset, const char *property)
 
        list = fdt_getprop(fdt, nodeoffset, property, &length);
        if (!list)
-               return -length;
+               return length;
 
        end = list + length;
 
@@ -571,7 +576,7 @@ int fdt_stringlist_search(const void *fdt, int nodeoffset, const char *property,
 
        list = fdt_getprop(fdt, nodeoffset, property, &length);
        if (!list)
-               return -length;
+               return length;
 
        len = strlen(string) + 1;
        end = list + length;