From patchwork Wed Jan 18 16:12:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilias Apalodimas X-Patchwork-Id: 643688 Delivered-To: patch@linaro.org Received: by 2002:a17:522:b9de:b0:4b9:b062:db3b with SMTP id fj30csp1853213pvb; Wed, 18 Jan 2023 08:12:26 -0800 (PST) X-Google-Smtp-Source: AMrXdXtknHjBb4ADIDKuXmzIz+wmBr0+edaP7VZ4eySyKx4y4PnYCwaZ6lCsJ5yStIOSuD+IHGVm X-Received: by 2002:a05:6808:200c:b0:360:b954:b0a0 with SMTP id q12-20020a056808200c00b00360b954b0a0mr5098116oiw.36.1674058345917; Wed, 18 Jan 2023 08:12:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674058345; cv=none; d=google.com; s=arc-20160816; b=g8etJooGZIW/PaiVAl9ndqRRjWSU3VWfX1rwpcGoa3t+GHWo4DCYPti8JoUk/JUdo1 iirJmgamkdpnmnysScmN8hccnOkRNBW9Sri19Y0zrnbfTcWb7baJwYzlSfaY3rq5IfXy F4B8BJVNe7vHrDzjSEB4X54ki52F1XX5oAuq/QCPMqcVU+7b3izHVsCDDZdxvyo44AMj Bl2Kw7gjSjZA9MlmL+ZjvTHncbCXqVnkAeIGh0R8ySGXzU0JbUJUnYHXCvjKPI87Ge7H R60UtI7NVlMcraE3EocMN6O75MuTjSvOKK36qjQ1N2AYJKEuJIRgwchxs9FfQv7H9/QG NmqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=s0o+1P+xTh3iiKNxenP3as1AjTFc1yMC8PVYRIX8MU8=; b=NTZftmenAtTB9a90jJKjigyD2w97zIud6ckuBJTbBkEBY+2IAMJZhFX0Sd0RDunY72 iTqG/Iu0V+vKltD8FQ88xfsYpxus/1HoHt7slhLis7Cvpvs4wbsIuTjHsPqkQ6plGO8C /YBGwWDa5RjtU4LBzhAMf01fUgg0zANgknpVWSlslYaX1KXV8EPQDxuarZC5UnRTH3y6 5SKFloX9SA7gOCFF64jry+WbH2LVHRn4z1eDeJrN2EARpXy8OAvdeBUqGkg7YZZDgiB4 wmBFDqOy+LBWRHi3kBF7Uv180JLZlsg6Nr9moJDbx9mhxc6cGGGnUwuQ1b+flMI4S2zZ PRWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KP6KtTpn; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id n125-20020acaef83000000b00354a66285c8si29926450oih.98.2023.01.18.08.12.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Jan 2023 08:12:25 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KP6KtTpn; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8DB6985603; Wed, 18 Jan 2023 17:12:20 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="KP6KtTpn"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 55B7082FE7; Wed, 18 Jan 2023 17:12:19 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id E93EE8560A for ; Wed, 18 Jan 2023 17:12:16 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ilias.apalodimas@linaro.org Received: by mail-ej1-x631.google.com with SMTP id vw16so21296322ejc.12 for ; Wed, 18 Jan 2023 08:12:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=s0o+1P+xTh3iiKNxenP3as1AjTFc1yMC8PVYRIX8MU8=; b=KP6KtTpnmtqIIEeEOCVGUsdrw2IZ78Dbv18AlJqO+dNOpaaqPLE3INBbC74lj4uGAT m8niEhA93DV8XMdt+fgH092Xo/Q3H15WRzPRmqnNF+rUNhqVNv4IwhB2u2pXaswYN5W5 lbBk46wTkmP/EXvwwY+iPd5F45rVUah2ym1OGax+Mhi6mbd+3aEKz77iP4k1VKohuzz0 hH1IZXRuu8kfAwl+U+slOkJqBuuPhFfVUvIGhqumDt76q9h5ahih/RopnuDOrV24loFN FHtxymUth1kUXfDvBMX0B5fKkNGEMo7y83AsmfmbrRA4IHw1hAvrcxN6mtCVLyofkfRG ZOrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=s0o+1P+xTh3iiKNxenP3as1AjTFc1yMC8PVYRIX8MU8=; b=tkZ7uyLLXDMjJzIAVek0qy9B348qDYvW1jxE0jcUGd67xnu28Qo7UKbDwLGFKGkFoi Oy3TQ9ycK+IpWyOUNOc2AWGB/13wOPIoOUjMHFR/5wEkB2V7Gb/2B9Gd+BdTr4Fr1QYm MPmNHB6Wlc53cRsAkLK+PQ0V/IqixHSWv3LQFuXhM5cfULx8tn21EqwH1aBUUjwcjHbr zkRXMKcUaKFeEn6W95Ky6v8BT2BTwal32ldl3J54DdL0gsnvsJMLOACvBE8epFyvzbH0 Ng7zx4pPjsec1djEhL+hXOiw2wcPop04b3b5M2NqKZwThN68E0/ngzCfwJz+CVPYF53I sr9w== X-Gm-Message-State: AFqh2kpRmrocuNk8UamwnPEXMqVfiybU3r/M4O5qHZ8IukV0R8676P9G 84hXNI7p76cINZy+s3Nx/lnFglqWQufGZU9C X-Received: by 2002:a17:907:7f14:b0:84d:3e5b:7c02 with SMTP id qf20-20020a1709077f1400b0084d3e5b7c02mr5041027ejc.22.1674058336565; Wed, 18 Jan 2023 08:12:16 -0800 (PST) Received: from localhost.localdomain ([2a02:85f:fc9d:e4b5:ed50:5d98:6c51:1254]) by smtp.gmail.com with ESMTPSA id x25-20020a170906b09900b0080345493023sm14658261ejy.167.2023.01.18.08.12.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Jan 2023 08:12:16 -0800 (PST) From: Ilias Apalodimas To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Heinrich Schuchardt Subject: [PATCH] efi_loader: silence 'Failed to load EFI variables' if the file is missing Date: Wed, 18 Jan 2023 18:12:08 +0200 Message-Id: <20230118161208.3919684-1-ilias.apalodimas@linaro.org> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean When we try to load EFI variables from a file in the ESP partition and the file is missing We print a scary error looking like => printenv -e ** Unable to read file ubootefi.var ** Failed to load EFI variables This is not an error though since the file wasn't there to begin with. So silence the warning by aborting the load if the file is not there, instead of failing the load. Signed-off-by: Ilias Apalodimas --- lib/efi_loader/efi_var_file.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/efi_loader/efi_var_file.c b/lib/efi_loader/efi_var_file.c index 62e071bd8341..7d7141473634 100644 --- a/lib/efi_loader/efi_var_file.c +++ b/lib/efi_loader/efi_var_file.c @@ -223,6 +223,12 @@ efi_status_t efi_var_from_file(void) return EFI_OUT_OF_RESOURCES; } + ret = efi_set_blk_dev_to_system_partition(); + if (ret != EFI_SUCCESS) + goto error; + if (!fs_exists(EFI_VAR_FILE_NAME)) + goto error; + ret = efi_set_blk_dev_to_system_partition(); if (ret != EFI_SUCCESS) goto error;