From nobody Sun Apr 5 13:12:53 2026 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DB8D62E92BC for ; Fri, 20 Feb 2026 16:10:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771603843; cv=none; b=oK9YURSHFNvf8GXpZAypE28V9GWfqMyHYpKxwCYPofAj4zXfH/xrQjUh4K+njHsvmBO5fZuq7v7eLmNfEQC4dzR9/BS7AdrJY9oLzUty/ZWmd0WUCYB33Lx+dg4ZDWYgTXUFwBUPGBnyCs0j6QIa0Sjv0uVH+bfee3S4QiPw/B4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771603843; c=relaxed/simple; bh=5W/1OpfJsz5Okun9JADdKci255cYWEN3kmucMXgI7v4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ANjsSiD9JtQ1SgNUXNGTZx+iN90RCYg6zBek4KypVM0ot0Uxn3Fxzx5TTEwhpeTK+G9tJREZMxnN7orXnw6oeV5DlgkcK7PQ/3aJaq/m9GlurmbLC8t7N1TE+PcNhRJGl/T40wIVdtOOT8RIVZya9OtWuC9HRsf7LLIyl2utw6c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=XoZudrdU; arc=none smtp.client-ip=185.246.85.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="XoZudrdU" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 8163D4E40945; Fri, 20 Feb 2026 16:10:38 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 563005FA8F; Fri, 20 Feb 2026 16:10:38 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 492B810368D45; Fri, 20 Feb 2026 17:10:36 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1771603837; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=kwjIfxJ8VNKkkqo4t0mWwpyEaLWQDyzfgT0yAJ2gX2E=; b=XoZudrdU9MU8FqiGo0MY7wjqPVjn/PHA5ebsam9oLxnojF2wMpeWVz8KZaBkFDhX0dcbBL uJPWsghim8fLkbuNDV0Q18OEIkIzq+LSM07yAxQR6P8F8gM7WnumCzk8WnNIsteajcyTWT hehwbRQWfn5hTdOAIXXsMAcdlea0F1LkEXzdsECoYKZcGohd14vNHxfNxrtGNYn6/LpgwQ tyiDXGQL6MN1la8r9gOHBPLVW9YsaOl38LiqNcN/cufurMz9gQeOPbeHTwbuUG5J88n1v3 ZHqs/c2OIUNpj575epYSLATY/Ih5FCQe1R+oeH/QYKK+zL33YdDJJAVFv8jjJA== From: Richard Genoud To: Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland Cc: Wentao Liang , Maxime Ripard , Thomas Petazzoni , linux-mtd@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, Richard Genoud Subject: [PATCH 4/6] mtd: rawnand: sunxi: replace hard coded value by a define - take2 Date: Fri, 20 Feb 2026 17:10:09 +0100 Message-ID: <20260220161011.999642-5-richard.genoud@bootlin.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260220161011.999642-1-richard.genoud@bootlin.com> References: <20260220161011.999642-1-richard.genoud@bootlin.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Last-TLS-Session-Version: TLSv1.3 Content-Type: text/plain; charset="utf-8" The user data length (4) has been replaced almost all over the file, but 2 places were forgotten. The user data is placed before the ECC, for each step. So, in sunxi_nfc_hw_ecc_read_extra_oob(), the offset of the user data in OOB is indeed ((ecc->bytes + USER_DATA_SZ) * ecc->steps); And in sunxi_nand_ooblayout_ecc(), the offset of the ECC chunk in OOB is the same offset plus the current user data size: section * (ecc->bytes + USER_DATA_SZ) + USER_DATA_SZ; Fixes: 1be7ac78b72f ("mtd: rawnand: sunxi: Replace hard coded value by a de= fine") Signed-off-by: Richard Genoud Reviewed-by: Jernej Skrabec --- drivers/mtd/nand/raw/sunxi_nand.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/nand/raw/sunxi_nand.c b/drivers/mtd/nand/raw/sunxi= _nand.c index 99d305bbda53..5d925b59b618 100644 --- a/drivers/mtd/nand/raw/sunxi_nand.c +++ b/drivers/mtd/nand/raw/sunxi_nand.c @@ -1051,7 +1051,7 @@ static void sunxi_nfc_hw_ecc_read_extra_oob(struct na= nd_chip *nand, { struct mtd_info *mtd =3D nand_to_mtd(nand); struct nand_ecc_ctrl *ecc =3D &nand->ecc; - int offset =3D ((ecc->bytes + 4) * ecc->steps); + int offset =3D ((ecc->bytes + USER_DATA_SZ) * ecc->steps); int len =3D mtd->oobsize - offset; =20 if (len <=3D 0) @@ -1747,7 +1747,7 @@ static int sunxi_nand_ooblayout_ecc(struct mtd_info *= mtd, int section, if (section >=3D ecc->steps) return -ERANGE; =20 - oobregion->offset =3D section * (ecc->bytes + USER_DATA_SZ) + 4; + oobregion->offset =3D section * (ecc->bytes + USER_DATA_SZ) + USER_DATA_S= Z; oobregion->length =3D ecc->bytes; =20 return 0;