From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.7 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7F845C48BD3 for ; Tue, 25 Jun 2019 01:02:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6333C204EC for ; Tue, 25 Jun 2019 01:02:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729443AbfFYBCi (ORCPT ); Mon, 24 Jun 2019 21:02:38 -0400 Received: from smtp2207-205.mail.aliyun.com ([121.197.207.205]:37321 "EHLO smtp2207-205.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727648AbfFYBCi (ORCPT ); Mon, 24 Jun 2019 21:02:38 -0400 X-Alimail-AntiSpam: AC=CONTINUE;BC=0.09668445|-1;CH=green;DM=CONTINUE|CONTINUE|true|0.121591-0.0103769-0.868032;FP=17101942903001009341|1|1|11|0|-1|-1|-1;HT=e02c03292;MF=liaoweixiong@allwinnertech.com;NM=1;PH=DS;RN=15;RT=15;SR=0;TI=SMTPD_---.EpjhFci_1561424547; Received: from PC-liaoweixiong.allwinnertech.com(mailfrom:liaoweixiong@allwinnertech.com fp:SMTPD_---.EpjhFci_1561424547) by smtp.aliyun-inc.com(10.147.40.44); Tue, 25 Jun 2019 09:02:33 +0800 From: liaoweixiong To: Miquel Raynal , Richard Weinberger , David Woodhouse , Brian Norris , Marek Vasut , Vignesh Raghavendra , Boris Brezillon , Frieder Schrempf , Peter Pan , Chuanhong Guo , Schrempf Frieder Cc: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, liaoweixiong Subject: [RESEND PATCH v2] mtd: spinand: read return badly if the last page has bitflips Date: Tue, 25 Jun 2019 09:02:29 +0800 Message-Id: <1561424549-784-1-git-send-email-liaoweixiong@allwinnertech.com> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In case of the last page containing bitflips (ret > 0), spinand_mtd_read() will return that number of bitflips for the last page. But to me it looks like it should instead return max_bitflips like it does when the last page read returns with 0. Signed-off-by: liaoweixiong Reviewed-by: Boris Brezillon Reviewed-by: Frieder Schrempf Fixes: 7529df465248 ("mtd: nand: Add core infrastructure to support SPI NANDs") --- drivers/mtd/nand/spi/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c index 556bfdb..6b9388d 100644 --- a/drivers/mtd/nand/spi/core.c +++ b/drivers/mtd/nand/spi/core.c @@ -511,12 +511,12 @@ static int spinand_mtd_read(struct mtd_info *mtd, loff_t from, if (ret == -EBADMSG) { ecc_failed = true; mtd->ecc_stats.failed++; - ret = 0; } else { mtd->ecc_stats.corrected += ret; max_bitflips = max_t(unsigned int, max_bitflips, ret); } + ret = 0; ops->retlen += iter.req.datalen; ops->oobretlen += iter.req.ooblen; } -- 1.9.1 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.7 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 82FADC4646B for ; Tue, 25 Jun 2019 01:02:41 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5CB18204EC for ; Tue, 25 Jun 2019 01:02:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="OWcDNOws" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5CB18204EC Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=allwinnertech.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mtd-bounces+linux-mtd=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=2yuzoWOQjo7zO+Vc2Kdc9BeoH3bC3/divf2Mm8NbmJg=; b=OWc DNOwsqxwXya45e4z+9KIh8G05omZk7wuoVPg5rWO9rvGXNBa81xmuEBP+ansreJbk3FdcDDUsA9gA /H5jZgp68KGIKSdGiMppPl4OPWT0/3/wdgpTQs869NxVRvLz4NJSzBziDznuu1Osfqk4TTxWC9vzO McQp9wrRnmNhUzv4B7e53mr4rF65fOMZHQ6QmRl7OQG3mNLTuPbWkU2Rn+V0uwNAHzLlxu0kbf5RY NbsAeQbhPvhsgpLS9cJlZ7TjbmW67uoRfknOehztL986loT96m5EASY/pCE99gNzalJjCIe56IkBY FCtdUpIEQ8UFyA45vyNHt2gnRm12tDg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hfZr5-0007IT-4j; Tue, 25 Jun 2019 01:02:39 +0000 Received: from smtp2207-205.mail.aliyun.com ([121.197.207.205]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hfZr2-0007IA-Ku for linux-mtd@lists.infradead.org; Tue, 25 Jun 2019 01:02:38 +0000 X-Alimail-AntiSpam: AC=CONTINUE; BC=0.09668445|-1; CH=green; DM=CONTINUE|CONTINUE|true|0.121591-0.0103769-0.868032; FP=17101942903001009341|1|1|11|0|-1|-1|-1; HT=e02c03292; MF=liaoweixiong@allwinnertech.com; NM=1; PH=DS; RN=15; RT=15; SR=0; TI=SMTPD_---.EpjhFci_1561424547; Received: from PC-liaoweixiong.allwinnertech.com(mailfrom:liaoweixiong@allwinnertech.com fp:SMTPD_---.EpjhFci_1561424547) by smtp.aliyun-inc.com(10.147.40.44); Tue, 25 Jun 2019 09:02:33 +0800 From: liaoweixiong To: Miquel Raynal , Richard Weinberger , David Woodhouse , Brian Norris , Marek Vasut , Vignesh Raghavendra , Boris Brezillon , Frieder Schrempf , Peter Pan , Chuanhong Guo , Schrempf Frieder Subject: [RESEND PATCH v2] mtd: spinand: read return badly if the last page has bitflips Date: Tue, 25 Jun 2019 09:02:29 +0800 Message-Id: <1561424549-784-1-git-send-email-liaoweixiong@allwinnertech.com> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190624_180236_848884_DAC55CB3 X-CRM114-Status: GOOD ( 12.11 ) X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: liaoweixiong , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-mtd" Errors-To: linux-mtd-bounces+linux-mtd=archiver.kernel.org@lists.infradead.org In case of the last page containing bitflips (ret > 0), spinand_mtd_read() will return that number of bitflips for the last page. But to me it looks like it should instead return max_bitflips like it does when the last page read returns with 0. Signed-off-by: liaoweixiong Reviewed-by: Boris Brezillon Reviewed-by: Frieder Schrempf Fixes: 7529df465248 ("mtd: nand: Add core infrastructure to support SPI NANDs") --- drivers/mtd/nand/spi/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c index 556bfdb..6b9388d 100644 --- a/drivers/mtd/nand/spi/core.c +++ b/drivers/mtd/nand/spi/core.c @@ -511,12 +511,12 @@ static int spinand_mtd_read(struct mtd_info *mtd, loff_t from, if (ret == -EBADMSG) { ecc_failed = true; mtd->ecc_stats.failed++; - ret = 0; } else { mtd->ecc_stats.corrected += ret; max_bitflips = max_t(unsigned int, max_bitflips, ret); } + ret = 0; ops->retlen += iter.req.datalen; ops->oobretlen += iter.req.ooblen; } -- 1.9.1 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/