From patchwork Sat Sep 12 10:42:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 1362809 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=bFe+Hjsc; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BpTjx0mjKz9sTM for ; Sat, 12 Sep 2020 20:43:14 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5A168821DB; Sat, 12 Sep 2020 12:43:08 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com 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=gmail.com header.i=@gmail.com header.b="bFe+Hjsc"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DF39180390; Sat, 12 Sep 2020 12:43:07 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ed1-x541.google.com (mail-ed1-x541.google.com [IPv6:2a00:1450:4864:20::541]) (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 89FAF80390 for ; Sat, 12 Sep 2020 12:43:05 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=marek.vasut@gmail.com Received: by mail-ed1-x541.google.com with SMTP id n13so12820104edo.10 for ; Sat, 12 Sep 2020 03:43:05 -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=UNIR8yRXnpbhBDbf4F1o5Bh+wQB2sWsIOfssKQRQerY=; b=bFe+Hjsc1RoNL4iC5ZkCcFqMUobsHP7QqzysL9O81BPeL1+GQ8Km3k0RLDZxiVCA7W 2BmeVHXio+ptV22y1M/2FSCmO9PX2446yZt8TsNFevV1LF9W3X6B7bygYN3K1dATHRT9 chWTJQDUun5gX78xaSJt/DD0UagNYgQlCEAvz4pRHSGwZLBC3NLBYY2X1xDuvxOBR6rh PK29OSX1ohgLfC9BvtuMDx9Brzrij0wDI/KLkeV1O7YstxkgQLVDbQRM7f3jwwR0gIIW xqGj58IP1HsWwXcwol+RkRMcA6R3crIMDbi1JzpVkwaKEi5SEW2gEPjkKr5Y2FNVuiIW gFKg== 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=UNIR8yRXnpbhBDbf4F1o5Bh+wQB2sWsIOfssKQRQerY=; b=dFI4X2+Di4xSJyWaWlHmlD0uM9cJggtcCxN+RXvxOnq903ptBFDdNgkZLI/lpqPGSv qYst0kBRar+qrPAbDVZe5fTf2d+mcFW2oG1y4lotGouUtBE6NGjtz8A9KmRpgGPbfrfu jyGKghfMjKf1XqEQHNaYRWFZ3ca3xTRMqywHyJGzgSaGx8axOLMTta2PIc6jizM7Jwk5 /PlVthUYDAm5knL+aiTy22+GLVTgRLn3tkdL4We3oXcb59+ptH+hKFHQ2T0qlVfA5VFv bKlXjUq2ShNrC0ehnI/axQVtPHuTVoYl5T1JNVY6bWKdm79HA8nqNeYFHn6Kcd29z2IV H7ng== X-Gm-Message-State: AOAM5307HgmQKmyRkZCnpxNzOyj0P0/pDeC7oUOV0wATmXmwvs/bb2N4 xIzkRjgeocZjFzBTyVaEPH2xhi6EJkM= X-Google-Smtp-Source: ABdhPJwRZgn7YarmPnhOBbhlMaBmaefapimNLqVIo9eL+ysPHBvsUjmx7mQ3SMh4yy0CjtSkXf8iqA== X-Received: by 2002:a50:f197:: with SMTP id x23mr7880787edl.367.1599907384888; Sat, 12 Sep 2020 03:43:04 -0700 (PDT) Received: from desktop.lan (ip-89-176-112-137.net.upcbroadband.cz. [89.176.112.137]) by smtp.gmail.com with ESMTPSA id l10sm4305201edr.12.2020.09.12.03.43.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 12 Sep 2020 03:43:03 -0700 (PDT) From: Marek Vasut X-Google-Original-From: Marek Vasut To: u-boot@lists.denx.de Cc: Marek Vasut , Michal Simek , Simon Glass , Tom Rini Subject: [PATCH] lib: fdt: Fix fdtdec_setup_mem..() conversion to livetree API Date: Sat, 12 Sep 2020 12:42:52 +0200 Message-Id: <20200912104252.80602-1-marek.vasut+renesas@gmail.com> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.3 at phobos.denx.de X-Virus-Status: Clean Repair incorrectly negated condition in the original patch which broke DT memory node parsing on everything which has more than one DT memory node, e.g. R-Car3. In case multiple valid memory nodes are present in the DT, the original patch would complete parsing cycle for the first memory node, then move on to the next one, identify it as a valid, and end the parsing. The fix is to invert the condition, to make the code behave as it did before the livetree conversion, so it would continue parsing the subsequent memory nodes as well. Fixes: c2f0950c33 ("lib: fdt: Convert fdtdes_setup_mem..() to livetree API") Signed-off-by: Marek Vasut Cc: Michal Simek Cc: Simon Glass Cc: Tom Rini Tested-by: Biju Das Reviewed-by: Michal Simek --- lib/fdtdec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/fdtdec.c b/lib/fdtdec.c index d3b22ec323..5f41f58a63 100644 --- a/lib/fdtdec.c +++ b/lib/fdtdec.c @@ -1101,7 +1101,7 @@ int fdtdec_setup_memory_banksize(void) if (ret < 0) { reg = 0; mem = get_next_memory_node(mem); - if (ofnode_valid(mem)) + if (!ofnode_valid(mem)) break; ret = ofnode_read_resource(mem, reg++, &res); @@ -1146,7 +1146,7 @@ int fdtdec_setup_mem_size_base_lowest(void) if (ret < 0) { reg = 0; mem = get_next_memory_node(mem); - if (ofnode_valid(mem)) + if (!ofnode_valid(mem)) break; ret = ofnode_read_resource(mem, reg++, &res);