From patchwork Sun Jan 15 19:53:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 642952 Delivered-To: patch@linaro.org Received: by 2002:a17:522:b9de:b0:4b9:b062:db3b with SMTP id fj30csp250921pvb; Sun, 15 Jan 2023 11:54:37 -0800 (PST) X-Google-Smtp-Source: AMrXdXsoTOZAnR3uKdO1XKtOmmh6z8iNrFvdq6MufX6taXSQHHC76c9o8y1m/t1qOe06UlQTtncp X-Received: by 2002:a05:6808:3096:b0:35e:bb7f:81b1 with SMTP id bl22-20020a056808309600b0035ebb7f81b1mr50273835oib.6.1673812477484; Sun, 15 Jan 2023 11:54:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673812477; cv=none; d=google.com; s=arc-20160816; b=lPwXTJJYLbdSAMWebxPbUABZe4f2gBTxAvkxAp2UBXYaSKa4FTeD4ArIT/hQoJLkOt XfcoRemAjpix6+yBt7qSLLS5S+4KSqV+Qs1lf9ujWQ+XvcNTodj0aR0FE9SAvktnT95k FLUhM0wCjgbqe3e2ZH7In0kOutehBOMIEmPDPinibMw0JKyzeNdkiIeFF6/PbXgMB6w9 6K623ZLWQf9CfWSIq64Qhh54y8FnC49hObvhFK7dfGC8X0d6SvAMK2GuhIPgvaMBccU+ kli3sN2x+9sppyyJ+udS381gJ7uoXFn9wEaBYu7TmAbwIDzL0W6meWZUHUMKG6Rcv256 xjxg== 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:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=b/wT0rHYwv6PdlfxakWpPyA9TYVh3NzY5qpsxTtTd5o=; b=cwI0fbiugMhVTxGsbABRyPGKrranOTwUNsCga+JB2nnxQ38rNYCBbDJlIULJVXTgpL jhRfixhqOd8v8UrL7gMiRaWSNONIqL0ZUHAdpwsFhQynv0hJlunAy/CTrSBcOBCvRF4K j3BpTFl9NB4AIaBHtdgnNxQFJyFn4HyJHLL7m73R1xUtY/8mzYBnV1VbzRk6XYZi2EFO fQJaMLhCo1higIXwYAWU1HLQfeVBq2imGBuHmfHsAMsZLVG/921+N3Ux3zBSia3aNIXN 4IMcXyYLODiCf4742Pt0+XmFWYsorzEDKqhlJSAfu2XGP45S9TLxUEEaCQhsgGvZXd6t mDEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=V0GZLnCK; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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. [85.214.62.61]) by mx.google.com with ESMTPS id fb18-20020a0568083a9200b0035a5ef9c139si24872787oib.172.2023.01.15.11.54.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Jan 2023 11:54:37 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=V0GZLnCK; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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 421A08559D; Sun, 15 Jan 2023 20:53:48 +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="V0GZLnCK"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E6CD3853B1; Sun, 15 Jan 2023 20:53:38 +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-lf1-x132.google.com (mail-lf1-x132.google.com [IPv6:2a00:1450:4864:20::132]) (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 4A63E8533E for ; Sun, 15 Jan 2023 20:53:36 +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=linus.walleij@linaro.org Received: by mail-lf1-x132.google.com with SMTP id bf43so40103269lfb.6 for ; Sun, 15 Jan 2023 11:53:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=b/wT0rHYwv6PdlfxakWpPyA9TYVh3NzY5qpsxTtTd5o=; b=V0GZLnCKDIPCrtiddH+B9ApOPkQ4XyTjF8PnXdP1roJMxNI73/sc7gOqpXepICvLra fugXS16jWyOrkHw/xm3Ecpbu3FPCcCCA6vE67Mfc+yFoRIFxqdg8v9WlDPGyfezqqf2g GD8ZuKFuVD1wnYHEwWKcu+f/88CqbgnacL4XW6oc3LL8H2/mM8UaXe8Uxy4vy2QJbesX RZinghVN76aU1uy6EOccraaUxp+OIX5JN4QLPy6OOhOUc124ov3qQccwKSFc3l9wFus5 xXHKk7ZO6eO2kEW7wlwSKrNlXELyaRjCf/MsI6khYQW6oZ2k+fCeZ3gXYowrskIzzHEH r6cA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=b/wT0rHYwv6PdlfxakWpPyA9TYVh3NzY5qpsxTtTd5o=; b=U8KQIEOeKgxcUNteNvgDpMDQ6HLeLt2g7truPNBmESumiWeeIm/fs6ChQP5Xnu6Wq4 UZVnxgVez7PQkCHDxNFOeUaKZae4D2bGda39YnSi06FUmHdLPerkDWw+so0ZOAYrgnXQ fE302DGOxOU5QdeY7ZlqvmfMm9dpKtqGIOdCdUMtg4zaEdhUJcOgZytv73bn2fAxNPVD 05bd8h1rriI/kdurkfvI8iOLJd2nZHWtVG3PZOjlFcpW4wgRlPlPyZyxckyErQXdkz1f h8sowMwlzcamfaVaKlhKZAajwjvyWb1DJJkj0Atljvu6GgStmUlaWL6ul6940OG5R3fY 6mCw== X-Gm-Message-State: AFqh2kpQj7DuYtHcaAKfcHUZ4Vom6T1eLLQ1JEo+xBvB0Do1JturizDq CAAAvODp84fhFKCB0E1rsX2XJnt883Jv9TVd X-Received: by 2002:ac2:4107:0:b0:4d5:640b:7e6b with SMTP id b7-20020ac24107000000b004d5640b7e6bmr1380724lfi.42.1673812415785; Sun, 15 Jan 2023 11:53:35 -0800 (PST) Received: from localhost.localdomain (c-05d8225c.014-348-6c756e10.bbcust.telenor.se. [92.34.216.5]) by smtp.gmail.com with ESMTPSA id r12-20020ac252ac000000b004aab0ca795csm4780439lfm.211.2023.01.15.11.53.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Jan 2023 11:53:35 -0800 (PST) From: Linus Walleij To: u-boot@lists.denx.de, Tom Rini Cc: Anand Gore , William Zhang , Kursad Oney , Joel Peshkin , Philippe Reynes , Claire Lin , Ray Jui , Kamal Dasu , Miquel Raynal , Linus Walleij Subject: [PATCH 05/14] mtd: rawnand: brcmnand: Fix ecc chunk calculation for erased page bitfips Date: Sun, 15 Jan 2023 20:53:03 +0100 Message-Id: <20230115195312.1477845-6-linus.walleij@linaro.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230115195312.1477845-1-linus.walleij@linaro.org> References: <20230115195312.1477845-1-linus.walleij@linaro.org> 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 From: Claire Lin In brcmstb_nand_verify_erased_page(), the ECC chunk pointer calculation while correcting erased page bitflips is wrong, fix it. Fixes: 02b88eea9f9c ("mtd: brcmnand: Add check for erased page bitflips") Signed-off-by: Claire Lin Reviewed-by: Ray Jui Signed-off-by: Kamal Dasu Signed-off-by: Miquel Raynal [Ported to U-Boot from the Linux kernel] Signed-off-by: Linus Walleij --- drivers/mtd/nand/raw/brcmnand/brcmnand.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c b/drivers/mtd/nand/raw/brcmnand/brcmnand.c index ef73205d8c18..bbaf403d2a03 100644 --- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c +++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c @@ -1817,6 +1817,7 @@ static int brcmstb_nand_verify_erased_page(struct mtd_info *mtd, int bitflips = 0; int page = addr >> chip->page_shift; int ret; + void *ecc_chunk; if (!buf) { #ifndef __UBOOT__ @@ -1836,7 +1837,9 @@ static int brcmstb_nand_verify_erased_page(struct mtd_info *mtd, return ret; for (i = 0; i < chip->ecc.steps; i++, oob += sas) { - ret = nand_check_erased_ecc_chunk(buf, chip->ecc.size, + ecc_chunk = buf + chip->ecc.size * i; + ret = nand_check_erased_ecc_chunk(ecc_chunk, + chip->ecc.size, oob, sas, NULL, 0, chip->ecc.strength); if (ret < 0)