Message ID | 20220809185639.750345-3-qemu@ben.fluff.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [v4,1/6] device_tree: add qemu_fdt_setprop_strings() helper | expand |
On Tue, Aug 09, 2022 at 07:56:36PM +0100, Ben Dooks wrote: > The qemu_fdt_setprop_string_array() does not return error codes and > will call exit() if any of the fdt calls fails (and should print an > error with the node being altered). This is done to prepare for the > change for qemu_fdt_setprop_strings() helper which does not return > any error codes (hw/core/guest-loader.c is the only place where an > return is checked). > > Signed-off-by: Ben Dooks <qemu@ben.fluff.org> > --- > hw/core/guest-loader.c | 22 +++++++--------------- > 1 file changed, 7 insertions(+), 15 deletions(-) > > diff --git a/hw/core/guest-loader.c b/hw/core/guest-loader.c > index 391c875a29..c61ebc4144 100644 > --- a/hw/core/guest-loader.c > +++ b/hw/core/guest-loader.c > @@ -57,25 +57,17 @@ static void loader_insert_platform_data(GuestLoaderState *s, int size, > > if (s->kernel) { > const char *compat[2] = { "multiboot,module", "multiboot,kernel" }; > - if (qemu_fdt_setprop_string_array(fdt, node, "compatible", > - (char **) &compat, > - ARRAY_SIZE(compat)) < 0) { > - error_setg(errp, "couldn't set %s/compatible", node); > - return; > - } > + qemu_fdt_setprop_string_array(fdt, node, "compatible", > + (char **) &compat, > + ARRAY_SIZE(compat)); > if (s->args) { > - if (qemu_fdt_setprop_string(fdt, node, "bootargs", s->args) < 0) { > - error_setg(errp, "couldn't set %s/bootargs", node); > - } > + qemu_fdt_setprop_string(fdt, node, "bootargs", s->args); > } > } else if (s->initrd) { > const char *compat[2] = { "multiboot,module", "multiboot,ramdisk" }; > - if (qemu_fdt_setprop_string_array(fdt, node, "compatible", > - (char **) &compat, > - ARRAY_SIZE(compat)) < 0) { > - error_setg(errp, "couldn't set %s/compatible", node); > - return; > - } > + qemu_fdt_setprop_string_array(fdt, node, "compatible", > + (char **) &compat, > + ARRAY_SIZE(compat)); > } > } > > -- > 2.35.1 > > Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
On Wed, Aug 10, 2022 at 5:08 AM Ben Dooks <qemu@ben.fluff.org> wrote: > > The qemu_fdt_setprop_string_array() does not return error codes and > will call exit() if any of the fdt calls fails (and should print an > error with the node being altered). This is done to prepare for the > change for qemu_fdt_setprop_strings() helper which does not return > any error codes (hw/core/guest-loader.c is the only place where an > return is checked). > > Signed-off-by: Ben Dooks <qemu@ben.fluff.org> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Alistair > --- > hw/core/guest-loader.c | 22 +++++++--------------- > 1 file changed, 7 insertions(+), 15 deletions(-) > > diff --git a/hw/core/guest-loader.c b/hw/core/guest-loader.c > index 391c875a29..c61ebc4144 100644 > --- a/hw/core/guest-loader.c > +++ b/hw/core/guest-loader.c > @@ -57,25 +57,17 @@ static void loader_insert_platform_data(GuestLoaderState *s, int size, > > if (s->kernel) { > const char *compat[2] = { "multiboot,module", "multiboot,kernel" }; > - if (qemu_fdt_setprop_string_array(fdt, node, "compatible", > - (char **) &compat, > - ARRAY_SIZE(compat)) < 0) { > - error_setg(errp, "couldn't set %s/compatible", node); > - return; > - } > + qemu_fdt_setprop_string_array(fdt, node, "compatible", > + (char **) &compat, > + ARRAY_SIZE(compat)); > if (s->args) { > - if (qemu_fdt_setprop_string(fdt, node, "bootargs", s->args) < 0) { > - error_setg(errp, "couldn't set %s/bootargs", node); > - } > + qemu_fdt_setprop_string(fdt, node, "bootargs", s->args); > } > } else if (s->initrd) { > const char *compat[2] = { "multiboot,module", "multiboot,ramdisk" }; > - if (qemu_fdt_setprop_string_array(fdt, node, "compatible", > - (char **) &compat, > - ARRAY_SIZE(compat)) < 0) { > - error_setg(errp, "couldn't set %s/compatible", node); > - return; > - } > + qemu_fdt_setprop_string_array(fdt, node, "compatible", > + (char **) &compat, > + ARRAY_SIZE(compat)); > } > } > > -- > 2.35.1 > >
diff --git a/hw/core/guest-loader.c b/hw/core/guest-loader.c index 391c875a29..c61ebc4144 100644 --- a/hw/core/guest-loader.c +++ b/hw/core/guest-loader.c @@ -57,25 +57,17 @@ static void loader_insert_platform_data(GuestLoaderState *s, int size, if (s->kernel) { const char *compat[2] = { "multiboot,module", "multiboot,kernel" }; - if (qemu_fdt_setprop_string_array(fdt, node, "compatible", - (char **) &compat, - ARRAY_SIZE(compat)) < 0) { - error_setg(errp, "couldn't set %s/compatible", node); - return; - } + qemu_fdt_setprop_string_array(fdt, node, "compatible", + (char **) &compat, + ARRAY_SIZE(compat)); if (s->args) { - if (qemu_fdt_setprop_string(fdt, node, "bootargs", s->args) < 0) { - error_setg(errp, "couldn't set %s/bootargs", node); - } + qemu_fdt_setprop_string(fdt, node, "bootargs", s->args); } } else if (s->initrd) { const char *compat[2] = { "multiboot,module", "multiboot,ramdisk" }; - if (qemu_fdt_setprop_string_array(fdt, node, "compatible", - (char **) &compat, - ARRAY_SIZE(compat)) < 0) { - error_setg(errp, "couldn't set %s/compatible", node); - return; - } + qemu_fdt_setprop_string_array(fdt, node, "compatible", + (char **) &compat, + ARRAY_SIZE(compat)); } }
The qemu_fdt_setprop_string_array() does not return error codes and will call exit() if any of the fdt calls fails (and should print an error with the node being altered). This is done to prepare for the change for qemu_fdt_setprop_strings() helper which does not return any error codes (hw/core/guest-loader.c is the only place where an return is checked). Signed-off-by: Ben Dooks <qemu@ben.fluff.org> --- hw/core/guest-loader.c | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-)