From patchwork Sun Mar 11 07:59:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: OuYang ZhiZhong X-Patchwork-Id: 884227 X-Patchwork-Delegate: boris.brezillon@free-electrons.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=yealink.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="bkiMieaq"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zzYVR0N2BzB2vs for ; Sun, 11 Mar 2018 19:01:48 +1100 (AEDT) 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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=zrIzQ23BfARXFVH7EA4Di/IHRsyrX6hai8+SNOJEsDs=; b=bkiMieaq1H2rSO 6SN+fu0h3hoARmzrHv+BGOfgHRw+yssSXO2MRilOnQbFIdMQknBysiIjBxpWKWs4zpKVtwrz4mRJT kwrngM6yeFdLXlwh+ecLLmiNXbcLPEoSV6vPUKOIXbzgWpsy1VEfCHe+9Xm5vWk0nS7Gp9plDF81L MaX20vG1HzAYcXK6JVqcw9+u5rpz8tbkw1MuVwIOlj68/SuLUMO+Dqd4l0cpVoGdGR7eceCGWqUHv m76LtyZmqwzzaeQF6TGgEKFU5cIiVj2PhREh9RTR/TEAE8PW2xYU31qFnWGy2bvnW2EXPiBuwrBlS bEdp+2+vNblEoNq8KwIw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1euvvI-00077I-Hr; Sun, 11 Mar 2018 08:01:40 +0000 Received: from sg05.corpemail.net ([128.199.149.210]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1euvuo-0005tq-Bm for linux-mtd@lists.infradead.org; Sun, 11 Mar 2018 08:01:22 +0000 Received: from unicom149.biz-email.net ([192.168.0.9]) by ssh247.corpemail.net ((Trust)) with ESMTP (SSL) id BAS00016; Sun, 11 Mar 2018 15:59:16 +0800 Received: from unicom145.biz-email.net ([192.168.0.69]) by unicom149.biz-email.net ((Outbound)) with ESMTP (SSL) id BAS00015; Sun, 11 Mar 2018 15:59:15 +0800 Received: from ([124.72.94.2]) by unicom145.biz-email.net (Antispam) with ASMTP (SSL) id BKS12316; Sun, 11 Mar 2018 15:59:16 +0800 Received: from ubuntu.yealink.com (10.84.1.206) by ylex-mbx02.yealink.com (192.168.1.24) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Sun, 11 Mar 2018 15:59:10 +0800 From: OuYang ZhiZhong To: Subject: [PATCH v4] mtdchar: fix usage of mtd_ooblayout_ecc() Date: Sun, 11 Mar 2018 15:59:07 +0800 Message-ID: <1520755147-4414-1-git-send-email-ouyzz@yealink.com> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 X-Originating-IP: [10.84.1.206] X-ClientProxiedBy: YLEX-CAS01.yealink.com (192.168.1.26) To ylex-mbx02.yealink.com (192.168.1.24) X-Spam-Status: No, hits=0.00 required=8.00 tests= version=3.3.2 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 3.3.2 (1.1) on unicom149.biz-email.net X-Corpemail-Scan-Result: 0 X-Corpemail-Rules: 0-0-0-3628-c X-Corpemail-Clean: Yes X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180311_000110_778769_3842828D X-CRM114-Status: UNSURE ( 7.76 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [128.199.149.210 listed in list.dnswl.org] 0.0 T_SPF_TEMPERROR SPF: test of record failed (temperror) -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: boris.brezillon@free-electrons.com, ouyzz@yealink.com, richard@nod.at, linux-kernel@vger.kernel.org, stable@vger.kernel.org, marek.vasut@gmail.com, oyzhizhong@gmail.com, linux-mtd@lists.infradead.org, cyrille.pitchen@wedev4u.fr, computersforpeace@gmail.com Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Section was not properly computed. The value of OOB region definition is always ECC section 0 information in the OOB area, but we want to get all the ECC bytes information, so we should call mtd_ooblayout_ecc(mtd, section++, &oobregion) until it returns -ERANGE. Fixes: c2b78452a9db ("mtd: use mtd_ooblayout_xxx() helpers where appropriate") Cc: Signed-off-by: OuYang ZhiZhong --- drivers/mtd/mtdchar.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c index de8c902..7d80a8b 100644 --- a/drivers/mtd/mtdchar.c +++ b/drivers/mtd/mtdchar.c @@ -479,7 +479,7 @@ static int shrink_ecclayout(struct mtd_info *mtd, for (i = 0; i < MTD_MAX_ECCPOS_ENTRIES;) { u32 eccpos; - ret = mtd_ooblayout_ecc(mtd, section, &oobregion); + ret = mtd_ooblayout_ecc(mtd, section++, &oobregion); if (ret < 0) { if (ret != -ERANGE) return ret; @@ -526,7 +526,7 @@ static int get_oobinfo(struct mtd_info *mtd, struct nand_oobinfo *to) for (i = 0; i < ARRAY_SIZE(to->eccpos);) { u32 eccpos; - ret = mtd_ooblayout_ecc(mtd, section, &oobregion); + ret = mtd_ooblayout_ecc(mtd, section++, &oobregion); if (ret < 0) { if (ret != -ERANGE) return ret;