From patchwork Wed Oct 24 03:39:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Qiang X-Patchwork-Id: 10654131 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 9608514BB for ; Wed, 24 Oct 2018 03:43:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8872A2A5AE for ; Wed, 24 Oct 2018 03:43:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7C9022A5B2; Wed, 24 Oct 2018 03:43:10 +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 343222A5AE for ; Wed, 24 Oct 2018 03:43:10 +0000 (UTC) Received: from localhost ([::1]:45460 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFA4a-00036F-M9 for patchwork-qemu-devel@patchwork.kernel.org; Tue, 23 Oct 2018 23:43:08 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51374) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFA3q-0001ir-3r for qemu-devel@nongnu.org; Tue, 23 Oct 2018 23:42:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFA1B-00019N-FU for qemu-devel@nongnu.org; Tue, 23 Oct 2018 23:39:42 -0400 Received: from mail-pl1-x644.google.com ([2607:f8b0:4864:20::644]:33226) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gFA1B-0000on-4S for qemu-devel@nongnu.org; Tue, 23 Oct 2018 23:39:37 -0400 Received: by mail-pl1-x644.google.com with SMTP id x6-v6so1609453pln.0 for ; Tue, 23 Oct 2018 20:39:21 -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=cfXMunm8rWMbvMIDD8VWNvzUYo8WilBtoaFCoe62Tx0=; b=LfhL8dxC0kg0fLUBCwnjFk1vIaEJDizkLeusLu0oiKS+F/3F05m85mXDUAN0y36RHu Xn+r0NJ8lI5XXMJbq88Tin5bJMBQuUouvAZBg9Oa/B6fQR6jDa6+/Krg3WmxjHpSPS9n UX5eO6LFnFVtb6lXCLqZsNJgd40kJoidneMRK3FVhYIWuVg28NV+bMc+inYffkn6+4IF xSOWZJk+oMEoxgk6cb0Yf3Xwh1V9RrANjcQun2+OKN3rOZvom6ND+DcwpQatpPgwp1JP AgZRTSRYDC+/PYgGfuDe4nz7roH4nqit2TJHyE1oUdRjNAbwaC7vR0UI4S+rRhLWEMs/ a8Iw== 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=cfXMunm8rWMbvMIDD8VWNvzUYo8WilBtoaFCoe62Tx0=; b=oASM+xZMnUO8CNL+zp/rI+iTZHYepTwM7bAc43BXIME0KuN66dT2jNVsW4/uKldrQK xigGLajKAsJRKM71YKB//Puv/cj1hDxoj2cMY+pHfGmXMPwB2AUQzP/uTIM3TdOjC93a SCXtxvOerYKASh2HC0At8hwegEHruxunTDNwIH+vFGNHD/pSR2HOplDjx+aWeUcAagqj S0pHqLSp8kpuxDPTDtwx3an+esDK1N5NXb/k3qoc8QvtFdw+gH8RTa15jMIoAPFr6NHx mWtxDzmTVjHBnLOPqUtStAH797Krqg3E4LQ5S6dloqwzxFtvNeF9z6Pmd+kGw+O/quHL AHvg== X-Gm-Message-State: AGRZ1gKU3ma4efoWJVMw+eZYxTJG5YbFJ7kATPIkaVDUTNyXqVFwFW9Y UrIdQfsKgvE40043WnjiLng= X-Google-Smtp-Source: AJdET5dwQaertZBWGUjUeYD6Hqb+mkWQlK1RP6PJgbOvL48wxV1BYQ8+gsTfViRsqMiZNuvfGLYD9w== X-Received: by 2002:a17:902:700a:: with SMTP id y10-v6mr937129plk.218.1540352360210; Tue, 23 Oct 2018 20:39:20 -0700 (PDT) Received: from localhost.localdomain.localdomain ([103.65.40.100]) by smtp.gmail.com with ESMTPSA id b88-v6sm697079pfc.150.2018.10.23.20.39.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 23 Oct 2018 20:39:19 -0700 (PDT) From: Li Qiang To: pbonzini@redhat.com, philmd@redhat.com Date: Tue, 23 Oct 2018 20:39:09 -0700 Message-Id: <1540352349-12737-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::644 Subject: [Qemu-devel] [PATCH] vl.c: print error message if loading fw_cfg file failed 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 It makes sense to print the error message while reading file failed. Signed-off-by: Li Qiang --- vl.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/vl.c b/vl.c index b2a405f..ee6f982 100644 --- a/vl.c +++ b/vl.c @@ -2234,8 +2234,10 @@ static int parse_fw_cfg(void *opaque, QemuOpts *opts, Error **errp) size = strlen(str); /* NUL terminator NOT included in fw_cfg blob */ buf = g_memdup(str, size); } else { - if (!g_file_get_contents(file, &buf, &size, NULL)) { - error_setg(errp, "can't load %s", file); + GError *err = NULL; + if (!g_file_get_contents(file, &buf, &size, &err)) { + error_setg(errp, "can't load %s, %s", file, err->message); + g_error_free(err); return -1; } }