Received: from eggs.gnu.org ([2001:4830:134:3::10]:50313) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a4XRZ-0003Fx-KW for qemu-devel@nongnu.org; Thu, 03 Dec 2015 12:13:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a4XRW-0003Ad-5h for qemu-devel@nongnu.org; Thu, 03 Dec 2015 12:13:21 -0500 From: Markus Armbruster References: <1449160660-3777-1-git-send-email-armbru@redhat.com> <1449160660-3777-3-git-send-email-armbru@redhat.com> <566073CE.8090601@redhat.com> Date: Thu, 03 Dec 2015 18:13:14 +0100 In-Reply-To: <566073CE.8090601@redhat.com> (Eric Blake's message of "Thu, 3 Dec 2015 09:54:38 -0700") Message-ID: <87r3j3jw0l.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH for-2.5 2/3] spapr_drc: Change value of property "fdt" from null back to {} List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: peter.maydell@linaro.org, david@gibson.dropbear.id.au, qemu-ppc@nongnu.org, qemu-devel@nongnu.org, agraf@suse.de Eric Blake writes: > On 12/03/2015 09:37 AM, Markus Armbruster wrote: >> prop_get_fdt() misuses the visitor API: when fdt is null, it doesn't >> visit anything. object_property_get_qobject() happily >> object_property_get_qobject(). Amazingly, the latter survives the > > Something got lost or otherwise corrupted in that sentence. Were you > trying to say one function happily calls another? If so, which of the > two "object_property_get_qobject()" strings should be changed, to what? No idea what happened. Correction: insert "calls" after "happily": prop_get_fdt() misuses the visitor API: when fdt is null, it doesn't visit anything. object_property_get_qobject() happily calls object_property_get_qobject(). Amazingly, the latter survives the misuse. Turns out we've papered over it long before prop_get_fdt() existed, in commit 1d10b44. >> misuse. Turns out we've papered over it long before prop_get_fdt() >> existed, in commit 1d10b44. >> >> However, commit 6c2f9a1 changed how we paper over it, and as a side >> effect changed qom-get's value from {} to null. Change it right back >> by fixing the visitor misuse. >> >> Signed-off-by: Markus Armbruster >> --- >> hw/ppc/spapr_drc.c | 5 +++++ >> 1 file changed, 5 insertions(+) >> >> diff --git a/hw/ppc/spapr_drc.c b/hw/ppc/spapr_drc.c >> index 4e7a1d3..dad157f 100644 >> --- a/hw/ppc/spapr_drc.c >> +++ b/hw/ppc/spapr_drc.c >> @@ -259,6 +259,11 @@ static void prop_get_fdt(Object *obj, Visitor *v, void *opaque, >> void *fdt; >> >> if (!drc->fdt) { >> + visit_start_struct(v, NULL, NULL, name, 0, &err); > > visit_start_struct(v, NULL, "fdt", name, 0, &err) > > would give a nicer error message, but only if there were an error > message to give. As already mentioned on 1/3, we are only using this > for output visitors which don't raise errors (in fact, &error_abort > would do, rather than worrying about error propagation). > > But I'm fine with the patch as you proposed it, once the commit message > is fixed. Some callers pass a third argument, some don't. We'll have to audit all visitor users anyway. We can decide whether and what to do about this issue then. > Reviewed-by: Eric Blake Thanks for your quick review! >> + if (!err) { >> + visit_end_struct(v, &err); >> + } >> + error_propagate(errp, err); >> return; >> } >> >>