From nobody Sat May 4 21:46:12 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1541052218722937.7046034806486; Wed, 31 Oct 2018 23:03:38 -0700 (PDT) Received: from localhost ([::1]:35524 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gI64v-00033h-OX for importer@patchew.org; Thu, 01 Nov 2018 02:03:37 -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) 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) 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) 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=C3=A9 --- 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 *fil= e_sizep, int *file_typep) { GError *err =3D NULL; - gboolean res; gchar *content; int file_type; unsigned int filehead; int bmp_bpp; =20 - res =3D g_file_get_contents(filename, &content, file_sizep, &err); - if (res =3D=3D 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; } --=20 1.8.3.1