From patchwork Sat Feb 11 15:29:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 652695 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp1537035wrr; Sat, 11 Feb 2023 07:29:59 -0800 (PST) X-Google-Smtp-Source: AK7set+GysNjVDJhsK+OeJOVyvGzcCgHZKyg0IHNM3OU+Ammrc2jjamUWh6/pdm9evasAlGQc8A1 X-Received: by 2002:a05:6870:4288:b0:16a:2408:ba8b with SMTP id y8-20020a056870428800b0016a2408ba8bmr4680596oah.3.1676129399660; Sat, 11 Feb 2023 07:29:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676129399; cv=none; d=google.com; s=arc-20160816; b=SdPJDB6tMII9DfAIO9IXn1XP0EDmkRevs/N35Oh1lPwApreoh2nVJI6QHQ7SlRReJT NgJdE2L4vc5j4jkIgirjRkEzCW9Lz3nBPazL4KsDOLYj20QcWHywGM6M0a6xx4jzdrjS 0Y8RJbz/khvJLBLbAMgnvE4SsvLtA5D4E2dL1A/zomwyg/N+0Ov/Re36om3xlvCNY6Zt /BrKvfHQ8BUHZWm8HE9wZxEjrk4bwh23aEoVbhWG5+9+DqQlYjc/vwR1w/FZNjFkDqIj AAM2TeAPG0MBwO1YC8cc+EzZVHVWhQPsKjzSJ9w084IBGBr/GNfuAVQmQ9SzSNbJ9iS7 eM2Q== 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=nJYAZ6ifUngWPRGzyCx0BQZ2eH1cOZu02ahLWuKjcvA=; b=nhV6CdWwLkwuzofwPBHcoxOMsYjedsvp8eD7yth7Fy93S1XcafuU633hhQysNgLmaM kurfeqT/3+E9cwvMR/PcAnHFaNKYMmKUoo28ZdKlhKpfgy1zeKONMrEsRNRbWKPKXvK+ J23GzgNMK8kfwxgMUfayrmCwoFeRRckmu8G3iPhL9JK01i0AhURZWmWxBjATsM/6ZckT zQ11RsEaPeBtsSCen977NbiTjHX9guaT7xcIU34nITKodOktVj0RjwQbyqzBMdVIlIKp WlE2CecOzJqywjGPWqNFLiDcf8t9HoA2LLxQy9dpSGXV2vA52PBHvkpajHsRoxkOHY2z rvYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="SOOza/VJ"; 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 h15-20020a056870538f00b0016316387e7bsi7663044oan.216.2023.02.11.07.29.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 Feb 2023 07:29:59 -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="SOOza/VJ"; 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 48BC185793; Sat, 11 Feb 2023 16:29:29 +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="SOOza/VJ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id EFF94856FA; Sat, 11 Feb 2023 16:29:23 +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-x62a.google.com (mail-ej1-x62a.google.com [IPv6:2a00:1450:4864:20::62a]) (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 271B88576F for ; Sat, 11 Feb 2023 16:29:21 +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-ej1-x62a.google.com with SMTP id m2so22440016ejb.8 for ; Sat, 11 Feb 2023 07:29:21 -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=nJYAZ6ifUngWPRGzyCx0BQZ2eH1cOZu02ahLWuKjcvA=; b=SOOza/VJiwgcZAMgktUj8JryemzcecdxS4W/LVKHO0aIHeeUZVXx3HJNs154c/Vpih BkyOulNH0J0VXwaCXzd6jEitKqcGQbyL++01cr9Tem/rB59zqkooCOfgH2b3Alq0Ir6n JFsj0W14qSWi5y/v728+fo4hn6jGmW45Zwv5yiCUttJgrBgxbFpFxoobvwyD+VOZ3VFR MNFOL2vuPIk9XhsHE+aSPZ3FN7Qi+OuDr3gB2IvKki4EYN5cDN9SkUBMA2bDrO4+XDil +L0IyQ56A1qKzodIBSWNI/jZ+hTvBkrNSZdSYFpmN5XjrUOcE7NqbdZRfGZ66+SuRQj2 LJdg== 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=nJYAZ6ifUngWPRGzyCx0BQZ2eH1cOZu02ahLWuKjcvA=; b=eB/fVwEvLtFH992tZwlLzZrXV/JYwLKFl+oouje5+XrjGhgbpasbteRFtvgm7t81V6 z8dg3pdDf00xHueSxCLV+2c9BYonY6Pc3zRg76o4/X3vbLURG1AHCggedFugz9mjYMGa R+JA+TweWN4JNS9sVmXwo3ruop3QvFbdXgUAaxisVwZJawQXZGhMMkQPKUmCggorG5WR cHbWo3h4Ou5S1sxzeQu/VEy4vhDv7oQX4/cAkM5MfgEnTtbZYlbfMdTqw2u0tR4JEVTi eaDUciIScZNLbMpORixBnlDwhOzUqVu03kH0GG3CvrOpd8iedUBzAAazYO7ktQaQZXY5 aFHw== X-Gm-Message-State: AO0yUKVUuurliLcg7g4Astzwkj9P1+T+pXQyLZkOhsPiL2eu9ro0hNMw NKsJn0I/H3IUTLmQAm2DK61LNwoIDTs+4lda X-Received: by 2002:a17:906:9417:b0:877:573d:e91c with SMTP id q23-20020a170906941700b00877573de91cmr19476606ejx.63.1676129360516; Sat, 11 Feb 2023 07:29:20 -0800 (PST) Received: from Fecusia.lan (c-05d8225c.014-348-6c756e10.bbcust.telenor.se. [92.34.216.5]) by smtp.gmail.com with ESMTPSA id f26-20020a170906825a00b0084c4b87aa18sm3977768ejx.37.2023.02.11.07.29.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 Feb 2023 07:29:19 -0800 (PST) From: Linus Walleij To: u-boot@lists.denx.de, Tom Rini , Michael Nazzareno Trimarchi Cc: Anand Gore , William Zhang , Kursad Oney , Joel Peshkin , Philippe Reynes , =?utf-8?b?UmFmYcWCIE1p?= =?utf-8?b?xYJlY2tp?= , Claire Lin , Ray Jui , Kamal Dasu , Miquel Raynal , Linus Walleij Subject: [PATCH v2 03/10] mtd: rawnand: brcmnand: Fix ecc chunk calculation for erased page bitfips Date: Sat, 11 Feb 2023 16:29:02 +0100 Message-Id: <20230211152909.1436133-4-linus.walleij@linaro.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230211152909.1436133-1-linus.walleij@linaro.org> References: <20230211152909.1436133-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 Acked-by: William Zhang --- 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 170aece0aa79..0402cb06a74b 100644 --- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c +++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c @@ -1765,6 +1765,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__ @@ -1784,7 +1785,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)