From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43829) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a8I7m-0001eH-VH for qemu-devel@nongnu.org; Sun, 13 Dec 2015 20:40:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a8I7j-0004Sy-M2 for qemu-devel@nongnu.org; Sun, 13 Dec 2015 20:40:26 -0500 Date: Mon, 14 Dec 2015 11:54:34 +1100 From: David Gibson Message-ID: <20151214005434.GB22783@voom.fritz.box> References: <1449792685-17000-1-git-send-email-david@gibson.dropbear.id.au> <1449792685-17000-2-git-send-email-david@gibson.dropbear.id.au> <566AD674.1060806@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="gatW/ieO32f1wygP" Content-Disposition: inline In-Reply-To: <566AD674.1060806@redhat.com> Subject: Re: [Qemu-devel] [PATCH 01/11] ppc: Cleanup error handling in ppc_set_compat() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: lvivier@redhat.com, thuth@redhat.com, qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, aik@ozlabs.ru, armbru@redhat.com, agraf@suse.de, qemu-ppc@nongnu.org --gatW/ieO32f1wygP Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Dec 11, 2015 at 06:58:12AM -0700, Eric Blake wrote: > On 12/10/2015 05:11 PM, David Gibson wrote: > > Current ppc_set_compat() returns -1 for errors, and also (unconditional= ly) > > reports an error message. The caller in h_client_architecture_support() > > may then report it again using an outdated fprintf(). > >=20 > > Clean this up by using the modern error reporting mechanisms. > >=20 > > Signed-off-by: David Gibson > > --- >=20 > > @@ -9208,12 +9208,13 @@ int ppc_set_compat(PowerPCCPU *cpu, uint32_t cp= u_version) > > break; > > } > > =20 > > - if (kvm_enabled() && kvmppc_set_compat(cpu, cpu->cpu_version) < 0)= { > > - error_report("Unable to set compatibility mode in KVM"); > > - ret =3D -1; > > + if (kvm_enabled()) { > > + ret =3D kvmppc_set_compat(cpu, cpu->cpu_version); > > + if (ret < 0) { > > + error_setg(errp, "Unable to set CPU compatibility mode in = KVM: %s", > > + strerror(-ret)); > > + } >=20 > Could use error_setg_errno() here instead of manually calling strerror(). Ah, thanks, I hadn't spotted that function before. --=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 --gatW/ieO32f1wygP Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJWbhNKAAoJEGw4ysog2bOSP48P/RO2zetXmTUi+FP7prNyMUe3 wEB9eqB+IhQvT077HRhkrb/zsP0HcAtCnDRAhUXeZ9zzJJabMxOka3wGB1bb8PYU 8u9ZNThcHzZ4bx/xe9dX+jnEuenJTGNYcmUh1eIM/8PG/KGJkBMaWzpvnOlHVpuX bUDg98rh3tSAlvueG29t736M3EuUX2Qy9Kzr4SgiRWiZvqzy8cq5AkPe9n2OBXnu 7QNhAE9c4fAIsA5vLkTe8b00C+yNWIcIXILD0h5NP5yE1PNSQBC6n2IbNDnr76/r 4Et2SO/ATo2K2BzwDd5otWgQXsTtehh8MS1HtVG3NgmIY6Dh46zAQsN3smBYUzCA Oe4vXhP8q6zlunbEPTqx8d0MmDNvbBxI2+eqc1MnU87WyUWLhnLr48eShs8bpO1s g8XN15zzBuF+504N86/9/oBcvOYkPWPYHuFgYvGSSne7iSVitz20ldi7tOvd7Uek 9X2ThZYGGRZ3Om/RO5KIOb0ZwaD4jmwKwXXq9qxJVK3rtbBBtpUBPEMxa+r80qwH NSnZt4E6tyKoD5/wlKJfkUKftzlLtR0OwCRoAoizpdZepyZVk6jS/aMXj5bhd8xr r4AfXwF3wGzWzs4CmNkgfeu4EE//j18qYZKV6GSmRQorwEdA6gpHABTSrMBzEmP3 zMj2HD8k1hBtvjUj+55s =KGCp -----END PGP SIGNATURE----- --gatW/ieO32f1wygP--