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: 10663503 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9484D17D5 for ; Thu, 1 Nov 2018 06:03:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7FB0E28628 for ; Thu, 1 Nov 2018 06:03:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 72AB52877F; Thu, 1 Nov 2018 06:03:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2935F28628 for ; Thu, 1 Nov 2018 06:03:24 +0000 (UTC) Received: from localhost ([::1]:35524 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gI64h-00033h-Jy for patchwork-qemu-devel@patchwork.kernel.org; Thu, 01 Nov 2018 02:03:23 -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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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; }