From patchwork Thu May 1 09:56:52 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 344493 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id E8A90140118 for ; Thu, 1 May 2014 20:01:41 +1000 (EST) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Wfnng-0000JK-MP; Thu, 01 May 2014 10:01:08 +0000 Received: from mail-wi0-f182.google.com ([209.85.212.182]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WfnlZ-0003ov-Qp for linux-mtd@lists.infradead.org; Thu, 01 May 2014 09:58:58 +0000 Received: by mail-wi0-f182.google.com with SMTP id d1so404372wiv.15 for ; Thu, 01 May 2014 02:58:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=qvUOwZQ+9t0Guwxs72Fbe8HjPejUoQZTAiKZCPHWI7I=; b=R3ctjVNJjQh7iNfpynttvo8urxZAFYFcagGU/C9nr4uVgsKfpILpusu7A3rnhE3wd0 TKkjULxLzdcTeLvhVBFZFidbUSp3JoaTtM34T6E4ArhOPZcO8t2lTPdifSFpOKFsdVwO +lW/drJM/6yolfSc8duAsEEVIGXJeHpTnVrxNYUNMwZQ6TGl40VFFUOTDP0emEnyNTnm 3D1jYadx/pusvRXOkJ0KUAUHkH8BvC3XwJLLXXCqBtG7LBKfGNqg2gYLVVANCcZfazMF v1lS7tHmJVaVg9+ae45gm0Z+CIyciJUbGR+7sq0KCgIWe3K9AWdjPg46v6hm31ZQ7LdG eUBg== X-Gm-Message-State: ALoCoQn/UBJvt0x78dKoIB0z07+TfCQkfRLVVILfWYErDpl41/TW7axfs5WcmM/DEbAd6cZ878sU X-Received: by 10.194.92.177 with SMTP id cn17mr8264575wjb.18.1398938316403; Thu, 01 May 2014 02:58:36 -0700 (PDT) Received: from lee--X1.home (host109-148-238-223.range109-148.btcentralplus.com. [109.148.238.223]) by mx.google.com with ESMTPSA id bj5sm2696494wib.3.2014.05.01.02.58.34 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 01 May 2014 02:58:35 -0700 (PDT) From: Lee Jones To: linux-kernel@vger.kernel.org Subject: [PATCH 45/47] mtd: nand: stm_nand_bch: catch unhandled calls to read and write to the OOB Date: Thu, 1 May 2014 10:56:52 +0100 Message-Id: <1398938214-17847-46-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1398938214-17847-1-git-send-email-lee.jones@linaro.org> References: <1398938214-17847-1-git-send-email-lee.jones@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140501_025858_037048_3072E557 X-CRM114-Status: GOOD ( 11.33 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.3.2 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.212.182 listed in list.dnswl.org] Cc: Lee Jones , computersforpeace@gmail.com, linux-mtd@lists.infradead.org, kernel@stlinux.com X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org The OOB is filled with ECC data which is handled by the hardware controller. It's a mistake for the framework to attempt to read or write to the OOB area. If that happens, we'll BUG() out. Signed-off-by: Lee Jones --- drivers/mtd/nand/stm_nand_bch.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/mtd/nand/stm_nand_bch.c b/drivers/mtd/nand/stm_nand_bch.c index 89f1263..bec7e23 100644 --- a/drivers/mtd/nand/stm_nand_bch.c +++ b/drivers/mtd/nand/stm_nand_bch.c @@ -1441,6 +1441,20 @@ static int bch_scan_bbt(struct mtd_info *mtd) return 0; } +static int bch_mtd_read_oob(struct mtd_info *mtd, + struct nand_chip *chip, int page) +{ + BUG(); + return 0; +} + +static int bch_mtd_write_oob(struct mtd_info *mtd, + struct nand_chip *chip, int page) +{ + BUG(); + return 0; +} + static int bch_block_isbad(struct mtd_info *mtd, loff_t offs, int getchip) { struct nand_chip *chip = mtd->priv; @@ -1598,6 +1612,9 @@ static void nandi_set_mtd_defaults(struct nandi_controller *nandi, mtd->ecclayout = &info->ecclayout; mtd->subpage_sft = 0; + chip->ecc.read_oob = bch_mtd_read_oob; + chip->ecc.write_oob = bch_mtd_write_oob; + chip->ecc.read_page = bch_read; chip->write_page = bch_write; chip->erase = bch_erase;