From patchwork Tue Mar 25 08:19:32 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 27004 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f197.google.com (mail-ie0-f197.google.com [209.85.223.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 2C96A20062 for ; Tue, 25 Mar 2014 08:44:22 +0000 (UTC) Received: by mail-ie0-f197.google.com with SMTP id rd18sf503768iec.4 for ; Tue, 25 Mar 2014 01:44:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id :in-reply-to:references:cc:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:content-type:content-transfer-encoding; bh=3jv8/vdwqq7EJS7w0oWda1THERglnOF586k1huj1nqw=; b=RwOR1xolX3iQU6oc97LvqT+yvKKGrTJxdCkeB9cnuzF+Bp10XTC8OWoquxkcR8BXC/ nrV5RLg4m1vj4twHhPZa7I7SQRhqIAa8hAC0a+Abqi6Xn3rNrzyl9O3L7W2OiyF9I9nA ovZn3nHwUUhNMLjBe9WyoEvhbZ/fg9PeS17rYcj6x+8FVoDaCIe0gQrons/cTcygfsRj 1QYEpboZB03f6mWfI4Ypq39b8am3P3aygb3avaXiCt3ByPIcqSHqhY8xa40sMIdv6Fix qnU3usImLZncSzBWgiHfk17guBEfrVxpNotIJqY/LRbh6IsCoBXRRNr7mw8Kh5iSr/DD xSPw== X-Gm-Message-State: ALoCoQmkB909lHVHBrJfixryBO1R2V0cz1eLcuQLS4KWTPkWhWZxsNe8hIeb3lyLSj3h/PJpW05h X-Received: by 10.182.24.134 with SMTP id u6mr14350713obf.24.1395737061589; Tue, 25 Mar 2014 01:44:21 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.98.97 with SMTP id n88ls133472qge.64.gmail; Tue, 25 Mar 2014 01:44:21 -0700 (PDT) X-Received: by 10.52.108.164 with SMTP id hl4mr5547840vdb.25.1395737061473; Tue, 25 Mar 2014 01:44:21 -0700 (PDT) Received: from mail-vc0-f176.google.com (mail-vc0-f176.google.com [209.85.220.176]) by mx.google.com with ESMTPS id l4si3543777vch.162.2014.03.25.01.44.21 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 25 Mar 2014 01:44:21 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.176 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.176; Received: by mail-vc0-f176.google.com with SMTP id lc6so152271vcb.7 for ; Tue, 25 Mar 2014 01:44:21 -0700 (PDT) X-Received: by 10.58.91.101 with SMTP id cd5mr53468517veb.5.1395737061400; Tue, 25 Mar 2014 01:44:21 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.78.9 with SMTP id i9csp286568vck; Tue, 25 Mar 2014 01:44:20 -0700 (PDT) X-Received: by 10.181.13.82 with SMTP id ew18mr20440125wid.22.1395737060159; Tue, 25 Mar 2014 01:44:20 -0700 (PDT) Received: from casper.infradead.org (casper.infradead.org. [2001:770:15f::2]) by mx.google.com with ESMTPS id ua15si2865817wib.15.2014.03.25.01.44.19 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 25 Mar 2014 01:44:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2001:770:15f::2 as permitted sender) client-ip=2001:770:15f::2; Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WSMx1-0002Ub-Hv; Tue, 25 Mar 2014 08:43:15 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WSMwh-0003kF-M1; Tue, 25 Mar 2014 08:42:55 +0000 Received: from bombadil.infradead.org ([2001:1868:205::9]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WSMsL-0003B8-9X for linux-mtd@merlin.infradead.org; Tue, 25 Mar 2014 08:38:25 +0000 Received: from mail-wi0-f170.google.com ([209.85.212.170]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WSMbc-00025h-TY for linux-mtd@lists.infradead.org; Tue, 25 Mar 2014 08:21:09 +0000 Received: by mail-wi0-f170.google.com with SMTP id bs8so3173440wib.3 for ; Tue, 25 Mar 2014 01:20:46 -0700 (PDT) X-Received: by 10.180.100.169 with SMTP id ez9mr21508071wib.15.1395735646394; Tue, 25 Mar 2014 01:20:46 -0700 (PDT) Received: from lee--X1.home (host109-148-113-193.range109-148.btcentralplus.com. [109.148.113.193]) by mx.google.com with ESMTPSA id k4sm5567676wib.19.2014.03.25.01.20.44 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 25 Mar 2014 01:20:45 -0700 (PDT) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [RFC 15/47] mtd: nand: stm_nand_bch: add compatible page size check Date: Tue, 25 Mar 2014 08:19:32 +0000 Message-Id: <1395735604-26706-16-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1395735604-26706-1-git-send-email-lee.jones@linaro.org> References: <1395735604-26706-1-git-send-email-lee.jones@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140325_012109_107215_08A0673D X-CRM114-Status: UNSURE ( 9.33 ) X-CRM114-Notice: Please train this message. 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.170 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record Cc: angus.clark@st.com, kernel@stlinux.com, lee.jones@linaro.org, linux-mtd@lists.infradead.org, pekon@ti.com, computersforpeace@gmail.com, dwmw2@infradead.org X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+patch=linaro.org@lists.infradead.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: 209.85.220.176 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Signed-off-by: Lee Jones --- drivers/mtd/nand/stm_nand_bch.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/mtd/nand/stm_nand_bch.c b/drivers/mtd/nand/stm_nand_bch.c index fbcd1b9..93fe835 100644 --- a/drivers/mtd/nand/stm_nand_bch.c +++ b/drivers/mtd/nand/stm_nand_bch.c @@ -29,6 +29,9 @@ #include "stm_nand_regs.h" #include "stm_nand_dt.h" +/* NANDi BCH Controller properties */ +#define NANDI_BCH_SECTOR_SIZE 1024 + /* Bad Block Table (BBT) */ struct nandi_bbt_info { uint32_t bbt_size; /* Size of bad-block table */ @@ -774,6 +777,12 @@ static int stm_nand_bch_probe(struct platform_device *pdev) dev_warn(&pdev->dev, "No timing data available\n"); } + if (mtd->writesize < NANDI_BCH_SECTOR_SIZE) { + dev_err(nandi->dev, + "page size incompatible with BCH ECC sector\n"); + return -EINVAL; + } + return 0; }