From patchwork Tue Mar 7 11:23:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 94974 Delivered-To: patch@linaro.org Received: by 10.140.82.71 with SMTP id g65csp1840062qgd; Tue, 7 Mar 2017 03:25:31 -0800 (PST) X-Received: by 10.84.231.198 with SMTP id g6mr34528945pln.20.1488885931142; Tue, 07 Mar 2017 03:25:31 -0800 (PST) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [65.50.211.133]) by mx.google.com with ESMTPS id i191si15686205pge.48.2017.03.07.03.25.31 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Mar 2017 03:25:31 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 65.50.211.133 as permitted sender) client-ip=65.50.211.133; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.infradead.org; dkim=neutral (body hash did not verify) header.i=@nifty.com; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 65.50.211.133 as permitted sender) smtp.mailfrom=linux-mtd-bounces+patch=linaro.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=8L0XgkgXbqK+CJU1EpdOKHu8l4au14VpR6mZVRJsOaA=; b=LTv XiYb1tQmSY1gezpnotrMxL7QACOZ2nY0HKV7pBkcYcl73KA4/huiBlToVMaFHkGMlUk8g2hT71+f9 6IRiDpV3oof/O7+RC01k/WCgrx55e/1FI3Vn96bmYTEZG1VNT9oARDgz9uyIpZPEcWgj6eUN5SR2v asxG/0poDQSLnm13pts2e8OUOAyTKLI/GgSXLguhIhHuNc4vHjICpE2ENjsvCRow94a+tDbekoFYk umVJSrs1Oheg1Y9Fg2mYV+OU7CQifsZiAz93xJ/z84EeKnOmluSeN4JELDhc3BPFzVx66+w/oXX3y N87e4iVtNy/fWjSANcAczvwp9GwkxWA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1clDF5-0002Ok-Ml; Tue, 07 Mar 2017 11:25:23 +0000 Received: from conuserg-09.nifty.com ([210.131.2.76]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1clDEl-0000zg-Ut for linux-mtd@lists.infradead.org; Tue, 07 Mar 2017 11:25:05 +0000 Received: from pug.jp.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-09.nifty.com with ESMTP id v27BO6s6020982; Tue, 7 Mar 2017 20:24:06 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com v27BO6s6020982 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1488885847; bh=kiDh73yjWFZ9k8HSYFamP7krEUZfK4+GhlyFghKeTrw=; h=From:To:Cc:Subject:Date:From; b=IRMa/wgXrhbnhlmozHMdy0sk6BdkKOZP+S4eNp27eelTBDLiikZjkFqmf0/f9ZFIY dVPU4Y4X9TWDqEsdD1cAKac0W3CUaXjGUrbqA/lQPM1qrtKrDZGxqcFubkCzjsLy51 IpfclonIhO8it8DbW70s970D9aqcaBQuoq8hvtWeXoB/54BXzeuZrOKO6PNW0rMIX3 TR/2g77xtWF8DoghTszrDtA1xEoYvWUGmYYQYNl3FOnFt+pDhO6ayWT5FUYTGuEluE NSKQGx4HlKOC+N7W7YdWehpzsueG/sDqwojro26EYNGmyF9vfDMU7UaK8O0hLsKBIo xAD9WcH4cC1RQ== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-mtd@lists.infradead.org Subject: [PATCH] mtd: nand: fix write accessor sanity checks Date: Tue, 7 Mar 2017 20:23:59 +0900 Message-Id: <1488885839-18470-1-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170307_032504_378943_BCC7CAF8 X-CRM114-Status: UNSURE ( 8.03 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -1.2 (-) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-1.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.7 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 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 , Marek Vasut , Richard Weinberger , linux-kernel@vger.kernel.org, Masahiro Yamada , Cyrille Pitchen , Brian Norris , David Woodhouse MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+patch=linaro.org@lists.infradead.org If the higher level accessor chip->write_page() is implemented, ecc->write_page() and ecc->write_page_raw() are not required. Signed-off-by: Masahiro Yamada --- drivers/mtd/nand/nand_base.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) -- 2.7.4 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index a3c0f47..c32e700 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c @@ -4585,11 +4585,12 @@ static bool invalid_ecc_page_accessors(struct nand_chip *chip) * default helpers are not suitable when the core does not * send the READ0/PAGEPROG commands. */ - return (!ecc->read_page || !ecc->write_page || - !ecc->read_page_raw || !ecc->write_page_raw || + return !ecc->read_page || !ecc->read_page_raw || (NAND_HAS_SUBPAGE_READ(chip) && !ecc->read_subpage) || - (NAND_HAS_SUBPAGE_WRITE(chip) && !ecc->write_subpage && - ecc->hwctl && ecc->calculate)); + (!chip->write_page && + (!ecc->write_page || !ecc->write_page_raw || + (NAND_HAS_SUBPAGE_WRITE(chip) && !ecc->write_subpage && + ecc->hwctl && ecc->calculate))); } /** @@ -4699,8 +4700,9 @@ int nand_scan_tail(struct mtd_info *mtd) if ((!ecc->calculate || !ecc->correct || !ecc->hwctl) && (!ecc->read_page || ecc->read_page == nand_read_page_hwecc || - !ecc->write_page || - ecc->write_page == nand_write_page_hwecc)) { + (!chip->write_page && + (!ecc->write_page || + ecc->write_page == nand_write_page_hwecc)))) { WARN(1, "No ECC functions supplied; hardware ECC not possible\n"); ret = -EINVAL; goto err_free;