From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58914) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a4don-0001lW-3x for qemu-devel@nongnu.org; Thu, 03 Dec 2015 19:01:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a4doh-0000jl-VF for qemu-devel@nongnu.org; Thu, 03 Dec 2015 19:01:45 -0500 Date: Fri, 4 Dec 2015 10:54:08 +1100 From: David Gibson Message-ID: <20151203235408.GC9559@voom.redhat.com> References: <1449160660-3777-1-git-send-email-armbru@redhat.com> <1449160660-3777-3-git-send-email-armbru@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="lMM8JwqTlfDpEaS6" Content-Disposition: inline In-Reply-To: <1449160660-3777-3-git-send-email-armbru@redhat.com> 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: Markus Armbruster Cc: peter.maydell@linaro.org, qemu-ppc@nongnu.org, qemu-devel@nongnu.org, agraf@suse.de --lMM8JwqTlfDpEaS6 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Dec 03, 2015 at 05:37:39PM +0100, 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 > misuse. Turns out we've papered over it long before prop_get_fdt() > existed, in commit 1d10b44. >=20 > 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. >=20 > Signed-off-by: Markus Armbruster > --- > hw/ppc/spapr_drc.c | 5 +++++ > 1 file changed, 5 insertions(+) >=20 > 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, vo= id *opaque, > void *fdt; > =20 > if (!drc->fdt) { > + visit_start_struct(v, NULL, NULL, name, 0, &err); > + if (!err) { > + visit_end_struct(v, &err); > + } > + error_propagate(errp, err); > return; > } > =20 I'm not entirely convinced by this. IIUC, this makes the output in the case of NULL (i.e. missing) fdt identical to the output in the case of an empty, valid fdt - in dtc syntax, this: / { }; Those are different cases from the point of view of the code which actually uses the fdt, and for purposes of debugging it, I suspect we want to expose that difference. I don't know what the QOMishly correct way of doing that is, though. Can we somehow make the "fdt" property disappear entirely if fdt is NULL? --=20 David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson --lMM8JwqTlfDpEaS6 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJWYNYgAAoJEGw4ysog2bOSRMEP/2rTjGIRnDSoKdZyoR0rfI2i +qKrYoY/FeaCAG1U7quoMN+JM7Y4FSatGIj/vbV/kYfnniae4nY9XWE380ai5Fty mQiTpHFPsZq+gr0jQyaYmRWBVZjbY8NQL8ICn6RhMdG8261ppKnapoXCgGhu5xSj p0fX5nLX1U/HQhGVNIi2zLjxlyVzooOe1cHUGCnAOXBFm1c/QAm6LhDO6JhRIXPI 8X+jvvKK9ZcBYxL26pwTNuFFdh1w5cUkiwXqnTMjE7sniJBXnLqwBjwlaCdxqHTc +yYTTxk490OcrCAJ5Xu2S98C03r/9uIlUymGt2anLr4+NP3R/8RJkNshNcwtdfXX 8BoqLURazLB/2JtfdlHUAwb5EyiXgM4morpl0+2vUbRoLfoJ6oz5eHVAmdDyjq6G kN0cS0ze3cx13KhifzdSVwwWigMFJKYByvR5tyMvg02CYW+OT3jlwXbSCGsm4PBj n4kzNtyDFfZh76ZnNAwdhZ3NEDqULs5c7nQXcfDJJgdznob0aZMP5ylM3+ZwwQK4 xfUgq/8VcLnpVOzVtAKdP/ThlURA+ynTmkXThPCXftGHozLRZS+CET7tJxwZzfcJ nJIA4uP7Mev96V3tVLN1bez08guvLEos8GtwX6ntc3BfK/vIBM/fOH1AeFzLh6qL 8dNelxK85etqzVUnTzIY =KOT/ -----END PGP SIGNATURE----- --lMM8JwqTlfDpEaS6--