From patchwork Tue Oct 9 02:39:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Li Qiang X-Patchwork-Id: 10631789 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 38AF414BD for ; Tue, 9 Oct 2018 02:48:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 256BE2954E for ; Tue, 9 Oct 2018 02:48:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 170C329681; Tue, 9 Oct 2018 02:48:06 +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 AB6362954E for ; Tue, 9 Oct 2018 02:48:05 +0000 (UTC) Received: from localhost ([::1]:49137 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g9i44-0001H0-FY for patchwork-qemu-devel@patchwork.kernel.org; Mon, 08 Oct 2018 22:48:04 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41028) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g9i36-0000bT-RY for qemu-devel@nongnu.org; Mon, 08 Oct 2018 22:47:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g9hvr-00073g-8o for qemu-devel@nongnu.org; Mon, 08 Oct 2018 22:39:38 -0400 Received: from mail-pg1-x52a.google.com ([2607:f8b0:4864:20::52a]:38796) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1g9hvr-00072q-15 for qemu-devel@nongnu.org; Mon, 08 Oct 2018 22:39:35 -0400 Received: by mail-pg1-x52a.google.com with SMTP id f8-v6so47772pgq.5 for ; Mon, 08 Oct 2018 19:39: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:mime-version :content-transfer-encoding; bh=V9lHZSDtntVFbx2c5DxKKRZ/eLQxxpkF2lMMeGis8eg=; b=g3auCY596ASn01DIXuI7gnYpe0vn7vJPUrt2JzXUCr7tomaCfl2bOUCwDedH9p31U5 W5VTS5+21/8+7q0IEG3vnTp9mGUFxk9hu7bTqNcoAfv3FKJehy1QyaJVo4cV4do5F5Yt U7D3MqZ+zPGKkE4pnnUZCmZugMRSjFfOTviv/YcUv0lLG76b77cc6U/Hdf8HkCSEUR+t i+aHvzF7mfp4XyH4SNthb+OHiicRdUv/kLCP9ZAKrjVihmNoZdo1dLuLkvdM2EbpsB1s GEE6Sb/i062N/M1iN3Qx4KqfgdcH2tiL1Njoh110yCszoTIVFioY+lKJA510vTv/6C32 5Aww== 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:mime-version :content-transfer-encoding; bh=V9lHZSDtntVFbx2c5DxKKRZ/eLQxxpkF2lMMeGis8eg=; b=KIcXFaUeFakoj9D8Rtfsl2HeAg/ovUGuwH4j+6Ts0grSuxsDQSxLMJZ+jKKzoYlbno K6UEjJBBHqOv7nsaQxPjdjSmEuC1SHvX3c1/7os44pj5jqn61Lbr3jjLlPhG7v3RnY3t rPngu/Iedg4+CVkfGq2GnYBLN8iYI+QLwhop6TjAHeH2jxG9tWxpmWAOMS9pF3fLtZBB 7pEv7cD4cWXIwjiMPf9u5uMggGMLsbjFWLWJuARSfhrUX99qQPV10dae+0WVrV+rk8Mi TxeTVYJz8qoDIVQNjNvRP4M7jpDd9EukYnXFACty+IQGQrDS1R4g0YCmltRgtVbBzZQw gubA== X-Gm-Message-State: ABuFfohJUkrzrL1jkg5R4mFealguXCeKsnNYtG1PodlweyQnjFqbjhh9 7e0STTpISIVQOpdDKO879ZU= X-Google-Smtp-Source: ACcGV60yTBKOdHzMgDukRIKfGqhUS4CBjJcvwcfMvL1KZqAHPUQl/aQQxXSlspKocvo5WiprQTkp7w== X-Received: by 2002:a63:ea43:: with SMTP id l3-v6mr23843096pgk.427.1539052773113; Mon, 08 Oct 2018 19:39:33 -0700 (PDT) Received: from localhost.localdomain.localdomain ([103.65.40.64]) by smtp.gmail.com with ESMTPSA id n87-v6sm11913477pfb.62.2018.10.08.19.39.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 Oct 2018 19:39:32 -0700 (PDT) From: Li Qiang To: pbonzini@redhat.com, f4bug@amsat.org Date: Mon, 8 Oct 2018 19:39:20 -0700 Message-Id: <1539052760-11730-1-git-send-email-liq3ea@gmail.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::52a Subject: [Qemu-devel] [PATCH v2] vl.c: print error message if load 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. Change since v1: free error Signed-off-by: Li Qiang Reviewed-by: Philippe Mathieu-Daudé --- vl.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/vl.c b/vl.c index 4e25c78..69fc77c 100644 --- a/vl.c +++ b/vl.c @@ -2207,8 +2207,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_report("can't load %s", file); + GError *error = NULL; + if (!g_file_get_contents(file, &buf, &size, &error)) { + error_report("can't load %s, %s", file, error->message); + g_error_free(error); return -1; } }