Otherwise we deference a NULL pointer.
I saw this while experimenting with libvirt on Xen on ARM, xl already checks
that the command line is non NULL and provides "" as a default.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
Cc: george.dunlap@citrix.com>
res = fdt_begin_node(fdt, "chosen");
if (res) return res;
- res = fdt_property_string(fdt, "bootargs", info->u.pv.cmdline);
- if (res) return res;
+ if (info->u.pv.cmdline) {
+ res = fdt_property_string(fdt, "bootargs", info->u.pv.cmdline);
+ if (res) return res;
+ }
res = fdt_end_node(fdt);
if (res) return res;