Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3691055pxb; Mon, 24 Jan 2022 15:29:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJzklTZq9DCEk7cZLGF0rpVHmvjTc2/5Q+T3ziBMOxu8dixOgyoT2Jz1NYEy56OBZHHJORu/ X-Received: by 2002:a17:90b:255:: with SMTP id fz21mr610675pjb.226.1643066955486; Mon, 24 Jan 2022 15:29:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643066955; cv=none; d=google.com; s=arc-20160816; b=xX9YTkYgP8lVCeTrTnd9dt7u6lIHtyNZmUkpBdU+N2HFJH/xduCB9kTPpG6Fy9TVFD V6hVrPiRtz1TnIVWR8AMo/R4QAQ9iDNnx9NVpchRfsySZTW1NT/UXiXpiPg1s2Zh+FSm ZuO5lbW/FQro2O1FctjVIwpu69dnvT/ZIKpK2Slks0ygYcJ3aX8TXdGTTsUMN991+1E9 jk87xrEuyASCUOm6k1FwKp3Pt53HFkYf0h1gE+SC5RYBqAyihPTO5wL9QvQ9Vr1JdP8H RBpZS110qAwzOIZvcCC3ZFv7BrvEeU6rrND9yfDuQGYxxDuhneJN7z8a0ueQwwBVgF4N /4Kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=FMSho4EYLNDl0x4iMJCSzgOOPY4VuheMcL1Ex8mwKD0=; b=gwENcAXpHHrkJsWppmn8KsSGgyr5L5Y2tF56MAzNqgLVJLo2I8yNCRWfoCqVDVesHC hOOcrwAkXYzcZwfc0H5yJ7L/Z8kPXvncy0rh245bW69EVzVyS6sPdf98zZ6NL7P5jus/ 60JsPPjEUUnAN9Ez85SPOQOhB4iJ+Q5jh+QEGG0pKv1Raii0zqRJSotprJOwXAV++WXe 8ks7/3JoZWB9uGEC4NYCJyfcbZ35WMlEp2zBATisud85rC+Wxd9osFlVVpAI3jWj8cKH ScoTVCtUSDyN9Fl+bdv8bMFdlv/ODj7F8TKjrDlO7hzab8+6vHG518oQRt8RsFVUTOOM ZKDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xq3+b+TU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v2si14062285plp.620.2022.01.24.15.29.01; Mon, 24 Jan 2022 15:29:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xq3+b+TU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1848538AbiAXXWm (ORCPT + 99 others); Mon, 24 Jan 2022 18:22:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38572 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1587714AbiAXW3b (ORCPT ); Mon, 24 Jan 2022 17:29:31 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF9E5C047CC8; Mon, 24 Jan 2022 12:55:06 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4ADC160916; Mon, 24 Jan 2022 20:55:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2034DC340E5; Mon, 24 Jan 2022 20:55:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057705; bh=zzKbzuFubpHHemI4OYJIDmPJ6QVU/JspdXhTqkh54ZU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xq3+b+TUtKKlWRpRBRAZDgPJcgeGOWSkv113E5U07QcQBnioyOhr9FVKJKtF9Nazc TcVDwfVF+idvz7/FHPp11nZKA7tosNN83dvgvb3xTbpNzeWRwPiJx6dnOVHOfYUcG0 iVLWh6hv+VaIEo7QPoeXTw184Shx9IifOOmO/FuI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paul Cercueil , Miquel Raynal Subject: [PATCH 5.16 0019/1039] mtd: rawnand: davinci: Avoid duplicated page read Date: Mon, 24 Jan 2022 19:30:08 +0100 Message-Id: <20220124184125.786487110@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Paul Cercueil commit 9c9d709965385de5a99f84b14bd5860e1541729e upstream. The function nand_davinci_read_page_hwecc_oob_first() first reads the OOB data, extracts the ECC information, programs the ECC hardware before reading the actual data in a loop. Right after the OOB data was read, it called nand_read_page_op() to reset the read cursor to the beginning of the page. This caused the first page to be read twice: in that call, and later in the loop. Address that issue by changing the call to nand_read_page_op() to nand_change_read_column_op(), which will only reset the read cursor. Cc: # v5.2 Fixes: a0ac778eb82c ("mtd: rawnand: ingenic: Add support for the JZ4740") Signed-off-by: Paul Cercueil Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/20211016132228.40254-2-paul@crapouillou.net Signed-off-by: Greg Kroah-Hartman --- drivers/mtd/nand/raw/davinci_nand.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/mtd/nand/raw/davinci_nand.c +++ b/drivers/mtd/nand/raw/davinci_nand.c @@ -401,7 +401,8 @@ static int nand_davinci_read_page_hwecc_ if (ret) return ret; - ret = nand_read_page_op(chip, page, 0, NULL, 0); + /* Move read cursor to start of page */ + ret = nand_change_read_column_op(chip, 0, NULL, 0, false); if (ret) return ret;