]> git.sur5r.net Git - u-boot/blobdiff - lib/libfdt/fdt_rw.c
i2c: uniphier: replace debug() with dev_dbg()
[u-boot] / lib / libfdt / fdt_rw.c
index 87d4030fb14d252498f4d2741aeeb1627baaa80b..3dc775261fb1073b14de83e669e4c592c4dfa15f 100644 (file)
@@ -228,8 +228,8 @@ int fdt_set_name(void *fdt, int nodeoffset, const char *name)
        return 0;
 }
 
-int fdt_setprop(void *fdt, int nodeoffset, const char *name,
-               const void *val, int len)
+int fdt_setprop_placeholder(void *fdt, int nodeoffset, const char *name,
+                           int len, void **prop_data)
 {
        struct fdt_property *prop;
        int err;
@@ -242,7 +242,22 @@ int fdt_setprop(void *fdt, int nodeoffset, const char *name,
        if (err)
                return err;
 
-       memcpy(prop->data, val, len);
+       *prop_data = prop->data;
+       return 0;
+}
+
+int fdt_setprop(void *fdt, int nodeoffset, const char *name,
+               const void *val, int len)
+{
+       void *prop_data;
+       int err;
+
+       err = fdt_setprop_placeholder(fdt, nodeoffset, name, len, &prop_data);
+       if (err)
+               return err;
+
+       if (len)
+               memcpy(prop_data, val, len);
        return 0;
 }