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: 29488 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f71.google.com (mail-yh0-f71.google.com [209.85.213.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 37449203F3 for ; Thu, 1 May 2014 09:58:38 +0000 (UTC) Received: by mail-yh0-f71.google.com with SMTP id i57sf10782173yha.2 for ; Thu, 01 May 2014 02:58:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=qvUOwZQ+9t0Guwxs72Fbe8HjPejUoQZTAiKZCPHWI7I=; b=ZxHlaw7RQja5V8VTt7fmDqtCKICXOyHVlEV6jKTuANECDXzFBgDN1cFHL0VLpRz7Kr PoxGTfpY3Uj5MkdKcSo4LI06djBJ029YJLsT1NXdpl8F+h0Q7D3ZiwZLsGjcveVV5lOQ BGmjFkwxUDsTB8O/JzBLzivrnwVgtIyaMSkWe9PLOAFd6Gxa30fF1In1r3TL/ZeXtahk HKsiRPoWaqsLfZeSnG5tr8ivjsBeU1rWIXjstc/mydJ/dDMvmObQA8j0jWCGwraulgyZ 19jVG/oJuFqI1Ueig3DkELvR4xcWurXj8KXMaMW35FA1ZinamPv7IneaxJMfNxSmvhzo /tKg== X-Gm-Message-State: ALoCoQnK/65vGfLjxhISP5swoIXQc6tXnJLkf2xVoQ5UeU7nzlhWkmipENG/7Y68KpoMb5PEycMZ X-Received: by 10.236.39.175 with SMTP id d35mr4281624yhb.12.1398938317986; Thu, 01 May 2014 02:58:37 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.97.200 with SMTP id m66ls916077qge.83.gmail; Thu, 01 May 2014 02:58:37 -0700 (PDT) X-Received: by 10.52.37.130 with SMTP id y2mr371418vdj.38.1398938317860; Thu, 01 May 2014 02:58:37 -0700 (PDT) Received: from mail-ve0-f173.google.com (mail-ve0-f173.google.com [209.85.128.173]) by mx.google.com with ESMTPS id sl10si3131483vdc.75.2014.05.01.02.58.37 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 01 May 2014 02:58:37 -0700 (PDT) Received-SPF: none (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) client-ip=209.85.128.173; Received: by mail-ve0-f173.google.com with SMTP id pa12so2652316veb.18 for ; Thu, 01 May 2014 02:58:37 -0700 (PDT) X-Received: by 10.58.107.65 with SMTP id ha1mr8344430veb.1.1398938317790; Thu, 01 May 2014 02:58:37 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp12988vcb; Thu, 1 May 2014 02:58:37 -0700 (PDT) X-Received: by 10.194.9.8 with SMTP id v8mr1225581wja.53.1398938317001; Thu, 01 May 2014 02:58:37 -0700 (PDT) Received: from mail-wi0-f169.google.com (mail-wi0-f169.google.com [209.85.212.169]) by mx.google.com with ESMTPS id n9si574705wie.64.2014.05.01.02.58.36 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 01 May 2014 02:58:36 -0700 (PDT) Received-SPF: none (google.com: lee.jones@linaro.org does not designate permitted sender hosts) client-ip=209.85.212.169; Received: by mail-wi0-f169.google.com with SMTP id hi5so453236wib.0 for ; Thu, 01 May 2014 02:58:36 -0700 (PDT) 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 Cc: computersforpeace@gmail.com, linux-mtd@lists.infradead.org, kernel@stlinux.com, Lee Jones 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-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: lee.jones@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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;