From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56939) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aK32t-0000Fm-PI for qemu-devel@nongnu.org; Fri, 15 Jan 2016 07:00:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aK32s-0002zF-BY for qemu-devel@nongnu.org; Fri, 15 Jan 2016 06:59:59 -0500 From: David Gibson Date: Fri, 15 Jan 2016 23:00:44 +1100 Message-Id: <1452859244-9500-11-git-send-email-david@gibson.dropbear.id.au> In-Reply-To: <1452859244-9500-1-git-send-email-david@gibson.dropbear.id.au> References: <1452859244-9500-1-git-send-email-david@gibson.dropbear.id.au> Subject: [Qemu-devel] [PATCH 10/10] pseries: Clean up error reporting in htab migration functions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: armbru@redhat.com Cc: aik@ozlabs.ru, David Gibson , qemu-ppc@nongnu.org, mdroth@linux.vnet.ibm.com, qemu-devel@nongnu.org The functions for migrating the hash page table on pseries machine type (htab_save_setup() and htab_load()) can report some errors with an explicit fprintf() before returning an appropriate error code. Change these to use error_report() instead. Signed-off-by: David Gibson Reviewed-by: Thomas Huth --- hw/ppc/spapr.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 9f3d590..51f15cb 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -1319,8 +1319,9 @@ static int htab_save_setup(QEMUFile *f, void *opaque) spapr->htab_fd = kvmppc_get_htab_fd(false); spapr->htab_fd_stale = false; if (spapr->htab_fd < 0) { - fprintf(stderr, "Unable to open fd for reading hash table from KVM: %s\n", - strerror(errno)); + error_report( + "Unable to open fd for reading hash table from KVM: %s", + strerror(errno)); return -1; } } @@ -1536,7 +1537,7 @@ static int htab_load(QEMUFile *f, void *opaque, int version_id) int fd = -1; if (version_id < 1 || version_id > 1) { - fprintf(stderr, "htab_load() bad version\n"); + error_report("htab_load() bad version"); return -EINVAL; } @@ -1557,8 +1558,8 @@ static int htab_load(QEMUFile *f, void *opaque, int version_id) fd = kvmppc_get_htab_fd(true); if (fd < 0) { - fprintf(stderr, "Unable to open fd to restore KVM hash table: %s\n", - strerror(errno)); + error_report("Unable to open fd to restore KVM hash table: %s", + strerror(errno)); } } @@ -1578,9 +1579,9 @@ static int htab_load(QEMUFile *f, void *opaque, int version_id) if ((index + n_valid + n_invalid) > (HTAB_SIZE(spapr) / HASH_PTE_SIZE_64)) { /* Bad index in stream */ - fprintf(stderr, "htab_load() bad index %d (%hd+%hd entries) " - "in htab stream (htab_shift=%d)\n", index, n_valid, n_invalid, - spapr->htab_shift); + error_report( + "htab_load() bad index %d (%hd+%hd entries) in htab stream (htab_shift=%d)", + index, n_valid, n_invalid, spapr->htab_shift); return -EINVAL; } -- 2.5.0