From patchwork Thu Nov 1 06:02:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Li Qiang X-Patchwork-Id: 991822 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="gRWY4QG0"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42lvkv0DMJz9sV2 for ; Thu, 1 Nov 2018 17:03:03 +1100 (AEDT) Received: from localhost ([::1]:35523 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gI64K-0001UV-Mj for incoming@patchwork.ozlabs.org; Thu, 01 Nov 2018 02:03:00 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35481) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gI63z-0001RQ-0M for qemu-devel@nongnu.org; Thu, 01 Nov 2018 02:02:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gI63u-0007sV-2M for qemu-devel@nongnu.org; Thu, 01 Nov 2018 02:02:38 -0400 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]:39874) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gI63t-0007s3-Si for qemu-devel@nongnu.org; Thu, 01 Nov 2018 02:02:33 -0400 Received: by mail-pg1-x542.google.com with SMTP id r9-v6so8513387pgv.6 for ; Wed, 31 Oct 2018 23:02:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=9/x9fWPsuZaieJUhphoKgcYtE0rEQlnqNAMFPiMJPHI=; b=gRWY4QG0nOLTh1Coq2Mn7zFiGrw5palr1Qor9U+bwKvnvX/d9KMQI5RN1jgmY/DaNV FIoB7f8raQBgeaMOV8Pf5bd71uKajY1zDIEzD2AQGodxVN+bK55dWOhKALvkitM06PFn G5ozPMGRqSD28APt6iKZtA3h7zKGuHrYGLcYiWA74ejCnfxZuDfmunEMmXq41tJdhey6 jslcM93nRUF7aVWZCC81fq7aNY3dWFBPDHCX10+LODPi9MNHYtCMmdeM/1CWQ+ngCqdC DOoKWZfNih0/jQICX7z+8ijrW6aGgujM8FRQacReJuh7iaqJFGZDrQHeOeGPowA2Nc37 k/PQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=9/x9fWPsuZaieJUhphoKgcYtE0rEQlnqNAMFPiMJPHI=; b=UV5duet26i8Luht0yPMsbjD0GbeWVE+JE6rgBPqhfVipDT+TxiMpNf5N99z3ssOfZT OCPtA+F62rgD4wl33bmV+ZMoR/sLJxx1Pj/8zKpSw/xgKZULnqjwms0ltMTnyIdT/7WT hs46N9Aw6JHRbFM4VhkJlWylV75f/At8ZpE7yrChzXjVOpMN+4K4KyPopeKsMRFgIqZp OO3BLN4BZ++gtPHAWDw0pvrcv5Q246bgsZ737KLWvZyHPb1cttky2Zj1zBY5JaZB/BaK JbA97kk76NHRmTnqTOw6HjUPJsTxfjx4M48yfPSus5IoJNt0z1o6ck+vbzuyFZihz22c a+2w== X-Gm-Message-State: AGRZ1gKxmoCDqi04Ma0qkhheBcnFeSMFrehJntQOspK4ofNevohdrTfX 3PyFn6jzI5nekLQeyUA3TvM= X-Google-Smtp-Source: AJdET5eKfSBP9pqQpdv5Y3x2H4mcoeisO07clVVvm/GaBmlpgm7rn9jR7e5dyR2ggkhTCpx3QhxYNw== X-Received: by 2002:a62:fb04:: with SMTP id x4-v6mr6434894pfm.210.1541052153029; Wed, 31 Oct 2018 23:02:33 -0700 (PDT) Received: from localhost.localdomain.localdomain ([103.65.40.100]) by smtp.gmail.com with ESMTPSA id k86-v6sm51833288pfb.167.2018.10.31.23.02.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 31 Oct 2018 23:02:32 -0700 (PDT) From: Li Qiang To: pbonzini@redhat.com, armbru@redhat.com, philmd@redhat.com, lersek@redhat.com Date: Wed, 31 Oct 2018 23:02:28 -0700 Message-Id: <1541052148-28752-1-git-send-email-liq3ea@gmail.com> X-Mailer: git-send-email 1.8.3.1 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::542 Subject: [Qemu-devel] [PATCH] hw: fw_cfg: Improve error message when can't load splash file X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Li Qiang , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" read_splashfile() reports "failed to read splash file" without further details. Get the details from g_file_get_contents(), and include them in the error message. Also remove unnecessary 'res' variable. Signed-off-by: Li Qiang Reviewed-by: Markus Armbruster Reviewed-by: Philippe Mathieu-Daudé --- hw/nvram/fw_cfg.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c index 946f765..3fcfa35 100644 --- a/hw/nvram/fw_cfg.c +++ b/hw/nvram/fw_cfg.c @@ -68,15 +68,14 @@ static char *read_splashfile(char *filename, gsize *file_sizep, int *file_typep) { GError *err = NULL; - gboolean res; gchar *content; int file_type; unsigned int filehead; int bmp_bpp; - res = g_file_get_contents(filename, &content, file_sizep, &err); - if (res == FALSE) { - error_report("failed to read splash file '%s'", filename); + if (!g_file_get_contents(filename, &content, file_sizep, &err)) { + error_report("failed to read splash file '%s': %s", + filename, err->message); g_error_free(err); return NULL; }