From patchwork Fri Dec 22 21:13:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quentin Schulz X-Patchwork-Id: 122660 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp2743491qgn; Fri, 22 Dec 2017 13:15:27 -0800 (PST) X-Google-Smtp-Source: ACJfBouk8UBCQlqWwC3Kowkf45zi0OOYY0ZZ3yRFMinnYWry1KE/4HDksfDlnmiKdUGVHUeyTr4f X-Received: by 10.80.213.90 with SMTP id f26mr17130458edj.225.1513977327860; Fri, 22 Dec 2017 13:15:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513977327; cv=none; d=google.com; s=arc-20160816; b=E4mLTpEo78SOfeWZoyw/wLCep1tOghvU1fUHlgJIKzndxuZOxLJcoGc+nllfwqV+0H eOnaysDQ7gteVmI+3lhcTW4S/71StweYhCLU1cQL6+t8q8i8XLsLzsZgOK5rVspXALFB 25UW5kIIcBhfRaypH8pSTG0MOicJKyXUfkSaCd/Y2nnfJQyRcGZutWQ4Rt4dlQMoSIqd mjykHcaw+Sr7cLGOzjsTJzr10B0KRcjJ9emFWsUPj5vNViKV1ZaaDNHDMTbBWdfXpJbO s2lC8q/eHLGVslM97SSOc260H7otoP5Vaf3V3wB9PVFWuerCMScDoqaz0jUKvehxKyHD lGBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:references :in-reply-to:message-id:date:to:from:arc-authentication-results; bh=A1UJZU2SD5UfhoP7M1neuXc1ok9vvinwDdvGG5lRSPE=; b=zHzuFSAHK0E0+/64lEohTalmXecUnTNH+yDMZ0HaTYM+249m+JxMecgeZtUl6Zomak xLp3fUPsvN8dFq6PqUjuW/lM5HzBuejE/+XnylIs1XjkGRhdfIC3Bw7Bsg1VsboMyMuy BgIxCV96mLiEKYebOZvC7TSOij8xuh3aLSGFBOwPavQrF/gCn7zcx7rsNmC+S/9vzLwo hezn8yaOt6PMfmUUy+GNs1CfiWqjbM9SsC3HVfd9rhtC2QUjHQZPChWf7csEQ5nYqXBv KxssPSsSecOlAvX63tdx7fRAXZadzPFbDUL1dzniNbnoen3ieQiP3Qk5tzMSY9kfWH98 xKFQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id a22si51141edb.327.2017.12.22.13.15.27; Fri, 22 Dec 2017 13:15:27 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by lists.denx.de (Postfix, from userid 105) id 66038C21FE3; Fri, 22 Dec 2017 21:14:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 4ABC1C21FAF; Fri, 22 Dec 2017 21:14:16 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id C02DDC21EF1; Fri, 22 Dec 2017 21:14:13 +0000 (UTC) Received: from mail.free-electrons.com (mail.free-electrons.com [62.4.15.54]) by lists.denx.de (Postfix) with ESMTP id 63588C21F2D for ; Fri, 22 Dec 2017 21:14:13 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id 841BF20748; Fri, 22 Dec 2017 22:14:12 +0100 (CET) Received: from localhost.localdomain (unknown [80.12.41.248]) by mail.free-electrons.com (Postfix) with ESMTPSA id E5D20203A1; Fri, 22 Dec 2017 22:14:11 +0100 (CET) From: Quentin Schulz To: jagan@openedev.com, maxime.ripard@free-electrons.com, hdegoede@redhat.com, sjg@chromium.org, wd@denx.de, andre.przywara@arm.com, lukma@denx.de Date: Fri, 22 Dec 2017 22:13:35 +0100 Message-Id: <2e3c82fa00f6176931a315320b8724770575965a.1513975247.git-series.quentin.schulz@free-electrons.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: References: In-Reply-To: References: Cc: thomas.petazzoni@free-electrons.com, u-boot@lists.denx.de Subject: [U-Boot] [PATCH 01/11] env: fix ret not being set and fails when no env could have been init X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" This patch is fixing things that most likely will be done by Maxime in the v2 of his patch series for multiple environments support, one way or the other. Signed-off-by: Quentin Schulz --- env/env.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/env/env.c b/env/env.c index 9b8b38c..5e70ddf 100644 --- a/env/env.c +++ b/env/env.c @@ -182,24 +182,25 @@ int env_init(void) struct env_driver *drv; int ret = -ENOENT; int prio; + bool init = false; for (prio = 0; (drv = env_driver_lookup(ENVO_INIT, prio)); prio++) { - if (!drv->init || !drv->init()) + if (drv->init) + ret = drv->init(drv); + else + ret = 0; + + if (!ret) { gd->env_has_init |= BIT(drv->location); + init = true; + } debug("%s: Environment %s init done (ret=%d)\n", __func__, drv->name, ret); } - if (!prio) + if (!prio || !init) return -ENODEV; - if (ret == -ENOENT) { - gd->env_addr = (ulong)&default_environment[0]; - gd->env_valid = ENV_VALID; - - return 0; - } - - return ret; + return 0; }