On 11.11.2013, at 09:16, peter.crosthwa...@xilinx.com wrote: > From: Peter Crosthwaite <peter.crosthwa...@xilinx.com> > > There are a mix of usages of the qemu_fdt_* API calls, some which > wish to assert and abort QEMU on failure and some of which wish to do > their own error handling. The latter in more correct, but the former > is in the majority and more pragmatic. However the asserting clients > are usually doing large numbers fdt ops and only want to assert if any > one of them breaks. So the cleanest compromising solution is: > > 1. Require an Error ** to be passes to all fdt ops. > 2. And perform no action if its already non-null (error condition). > 3. If no Error ** is given report errors to stderr > > Step one allows clients to do their own error handling if they wish > too, which is the most flexible: > > Error *err = NULL; > fdt_foo( ... , &err); > if (err) { > /* handle error my special way */ > } > > Step two allows you to do a large number of fdt ops then check them > all only the once at the end: > > Error *err = NULL; > fdt_foo( ... , &err); > fdt_bar( ... , &err); > fdt_baz( ... , &err); > if (err) { > /* First encountered error will be in err */ > } > > Step 3, handles the common case where the error is not an issue, but > just needs to make noise at the user (via stderr). This seems common for > bootloader code that sets chosen and initrd props etc (rather than machine > description). > > All error reporting is stylistically udpated to use Error ** instead of > integer return codes and no more exit(1) on failures. > > Signed-off-by: Peter Crosthwaite <peter.crosthwa...@xilinx.com>
Thanks a lot. I've applied the first two patches to ppc-next with some adjustments to also cover hw/arm/virt.c. But this patch is too much work to rebase to current master :). Please repost a version that also covers virt.c. I'd also like to see an Ack from Peter at least. Alex