]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
karo: fdt: improve error handling when creating phandle
authorLothar Waßmann <LW@KARO-electronics.de>
Mon, 7 Oct 2013 12:26:22 +0000 (14:26 +0200)
committerLothar Waßmann <LW@KARO-electronics.de>
Mon, 7 Oct 2013 12:26:22 +0000 (14:26 +0200)
board/karo/common/fdt.c

index 5103e27e47f8bac622a9bcf33f98cdefdf7fd8a2..04273208e776baa028468b1cfa72beda9fe93869 100644 (file)
@@ -335,16 +335,18 @@ static int fdt_update_native_fb_mode(void *blob, int off)
 {
        int ret;
        uint32_t ph;
-       int i;
 
-       for (i = 1; i < 16; i++) {
-               fdt_set_totalsize(blob, fdt_totalsize(blob) + 8 * 4);
-               karo_set_fdtsize(blob);
+       debug("Creating phandle at offset %d\n", off);
+       ph = fdt_create_phandle(blob, off);
+       if (!ph) {
+               ret = fdt_increase_size(blob, 512);
+               if (ret) {
+                       printf("Failed to increase FDT size: %d\n", ret);
+                       return ret;
+               }
                ph = fdt_create_phandle(blob, off);
-               if (ph)
-                       break;
        }
-       if (ph == 0) {
+       if (!ph) {
                printf("Failed to create phandle for video timing\n");
                return -ENOMEM;
        }