Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp219532lqb; Tue, 28 May 2024 13:30:23 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWpdjX3tx/WwzWW8RRHUGWpGm0Z46tNBjpCxz6mI1mBDYOTI8591q0g9aP+RZG4T7Pa/Xv9IBoNjdWiemx+096thAFUZZU6N3BuOxGO+Q== X-Google-Smtp-Source: AGHT+IF9yZi1wTnAG0NDFNAqzKi4OTDAmNiUKfA+fnhA2s+z1JrXIkwWA9g8lAOj3AZZOh8IZuKp X-Received: by 2002:a50:d65b:0:b0:579:c37c:1b3a with SMTP id 4fb4d7f45d1cf-579c37c1d6emr6427000a12.29.1716928223670; Tue, 28 May 2024 13:30:23 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716928223; cv=pass; d=google.com; s=arc-20160816; b=FFnK/EJGSKo3veHXIltdMjT5GmG9GuMwCLZhuwfjEKXVyW4B4yOd3y80eSdCn/ZJeO lehKkAPFMPOgLeQrVu6VH0/w2D9n4WmrSja4o4iQi4jQiaaaxLnEpaUtAMSJVP1VRmpC k851vVH73l/delxXNF886CXvH4SFsYYFO4Hnm8EZXF4l28+tHJK2W+0qoYFsUyRshaDs 2bzEwUUG9WCevFTHP5F+NYK077+gPfodUsQw5IerWSqBCvF8IAGM/xgFYrume49AEc0b Wk9zGBTb5TtdDw2qqHTZlITCBKJ2llWrWWPT5BmRlj5m4QCUCNk6dct3HdNPhPM0njz7 5SUg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=xXSeWt05TLb601SfGN/p7iRNqLt0FM3oonOB26yS+wo=; fh=U6CGyhe0nAc68QPSdw/7pBff6XxSx5Ch7bP8crz+iAM=; b=k7vc67EEkA2/7T2T2Rch6WrkOzjK4KS/F/65nrG5IVP5At5yA2leR27ffbGaGGnU5g GBmAFn6zVXxek5UgNbrxZZXffBnUgbzareRgXRNsjfve7i94/6wiwkU3AXrK/Qng04Ih JfQuSJUxYDfz/SK8YLO0h7GYiHxSPaJXG/zTNnX26WuIt0+Iv8jV1P0itzPZ/ZPtpROA pDAvUMy9cSlXE+B+N5j2bpk8YLWCjDtsk1BDfPqHLsMHRrqrYwkGDw/ZKC5SSYYH36an s7kSCcuAFeNKPu/7I2gveO88KX0ykLKp23HYnOjAuiRdeoiSC2sMr4P28qPf0N2T9q74 MmAw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=pengutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-193037-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-193037-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-578cc89f6b2si4070525a12.170.2024.05.28.13.30.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 May 2024 13:30:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-193037-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=pengutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-193037-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-193037-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 6937D1F247BD for ; Tue, 28 May 2024 20:30:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 59FE0178367; Tue, 28 May 2024 20:30:17 +0000 (UTC) Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (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 656B0F4EB for ; Tue, 28 May 2024 20:30:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716928216; cv=none; b=u7AGkprtvL0D66gHpb5u1qRy9gj7Y7DN3rSbwcFkohafEJVpAUEENwN34va+n9V+JAyTp+HNyYUULHRsTUG4Vqmbk/0osWhDHmR0jqwQUzvV5f6vX6pNJ8mbHaH3dfWU5lFHUm2mjJ0GywfdB7lZe0RgvPnVcP30ZGG7nmuay2Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716928216; c=relaxed/simple; bh=VPSKgjjYli5gLV+KUcp9LcQNDc1487vyy1pMwmdGU3A=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=S0VradLLpczBcQBe8TvBOtEdY9AMNnTOq4wMg0dyUidy1xZ2fmNWHu9vUiTgLoq759hoqSfq+XtW2P0ChZRXlrRsPmz7V49k8ic6rlr9eSp41D2mR5FH4mwlrsZbp3+4sTDC5+VuOLLgOKNKn/03EPtM6lsuOtf8RnmRO/MNWGM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sC3SW-0007Mg-AK; Tue, 28 May 2024 22:30:12 +0200 Received: from [2a0a:edc0:0:1101:1d::28] (helo=dude02.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sC3SU-003N9K-TD; Tue, 28 May 2024 22:30:10 +0200 Received: from localhost ([::1] helo=dude02.red.stw.pengutronix.de) by dude02.red.stw.pengutronix.de with esmtp (Exim 4.96) (envelope-from ) id 1sC3SU-006Cok-2X; Tue, 28 May 2024 22:30:10 +0200 From: Sascha Hauer To: linux-mtd@lists.infradead.org Cc: linux-kernel@vger.kernel.org, Miquel Raynal , Richard Weinberger , Sascha Hauer Subject: [PATCH] mtd: nand: mxc_nand: always copy_spare() for page write Date: Tue, 28 May 2024 22:30:06 +0200 Message-Id: <20240528203006.1479230-1-s.hauer@pengutronix.de> X-Mailer: git-send-email 2.39.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: s.hauer@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org When doing a page write we always have to copy the OOB data in place, as the controller will always write it. Not copying it means we write random data to the OOB area. Fixes: 3df54960b63cc ("mtd: nand: mxc_nand: implement exec_op") Signed-off-by: Sascha Hauer --- Miquel, feel free to fixup the original patch with this. --- drivers/mtd/nand/raw/mxc_nand.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/mtd/nand/raw/mxc_nand.c b/drivers/mtd/nand/raw/mxc_nand.c index 9d50f41b3d5a1..e90c6047e82a5 100644 --- a/drivers/mtd/nand/raw/mxc_nand.c +++ b/drivers/mtd/nand/raw/mxc_nand.c @@ -806,8 +806,7 @@ static int mxc_nand_write_page_ecc(struct nand_chip *chip, const uint8_t *buf, struct mxc_nand_host *host = nand_get_controller_data(chip); int ret; - if (oob_required) - copy_spare(mtd, false, chip->oob_poi); + copy_spare(mtd, false, chip->oob_poi); host->devtype_data->enable_hwecc(chip, true); @@ -823,8 +822,7 @@ static int mxc_nand_write_page_raw(struct nand_chip *chip, const uint8_t *buf, { struct mtd_info *mtd = nand_to_mtd(chip); - if (oob_required) - copy_spare(mtd, false, chip->oob_poi); + copy_spare(mtd, false, chip->oob_poi); return nand_prog_page_op(chip, page, 0, buf, mtd->writesize); } -- 2.39.2