libata: remove WARN() for DMA or PIO command without data
[pandora-kernel.git] / drivers / of / fdt.c
index aeec35b..a84c03c 100644 (file)
@@ -388,6 +388,10 @@ static void __unflatten_device_tree(struct boot_param_header *blob,
        /* Allocate memory for the expanded device tree */
        mem = (unsigned long)
                dt_alloc(size + 4, __alignof__(struct device_node));
+       if (!mem)
+               return;
+
+       memset((void *)mem, 0, size);
 
        ((__be32 *)mem)[size / 4] = cpu_to_be32(0xdeadbeef);
 
@@ -681,9 +685,14 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname,
        if (p != NULL && l > 0)
                strlcpy(data, p, min((int)l, COMMAND_LINE_SIZE));
 
+       /*
+        * CONFIG_CMDLINE is meant to be a default in case nothing else
+        * managed to set the command line, unless CONFIG_CMDLINE_FORCE
+        * is set in which case we override whatever was found earlier.
+        */
 #ifdef CONFIG_CMDLINE
 #ifndef CONFIG_CMDLINE_FORCE
-       if (p == NULL || l == 0 || (l == 1 && (*p) == 0))
+       if (!((char *)data)[0])
 #endif
                strlcpy(data, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
 #endif /* CONFIG_CMDLINE */