From patchwork Thu May 1 09:56:23 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 29459 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f198.google.com (mail-vc0-f198.google.com [209.85.220.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7E148203F3 for ; Thu, 1 May 2014 09:57:41 +0000 (UTC) Received: by mail-vc0-f198.google.com with SMTP id ij19sf9614108vcb.1 for ; Thu, 01 May 2014 02:57:41 -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=VpY4TXWPRaQ9w1ZMZkO8/3TH40+lQJMn6JWAe9QMDoI=; b=FJ2Ssi6Ya9EIzYGJm0DCHjLsrPRLd1YurH41NEapfgSKwfUAfS3JaGoLHJYH74qau9 JluvdE+d0v+9PNqLCYFtOXktHfBx9zquEDidiZPLmgxAO1IcIM0KuCLOwzqTMMT0F8uY DPpzqkVIFLFQfc5Fo2vY1B8budKeHNE2+rZtp0fs4v3YCW7WjEgFy0GAqxvxBjK7PnjW z53mPM0XjSWl49mm2JCNwp1sm/xwIYRsp6EzLEhLo62aV5SN3KKEKJnoRRfg9a5HIyxG EtiUk9RvyzRG+xFTZhyRbU77uuTt+nG9rX7PkuTKbj55lztFlabIIPOFo/qkm7iH4ail Q7/w== X-Gm-Message-State: ALoCoQkc5FdbxEW17ZKZ7fcvnGTt2wW5hgPpMwYY4bDYbb5cf10QEYxLB741yIWpy+RjVY/6jdf0 X-Received: by 10.236.142.212 with SMTP id i60mr4210542yhj.39.1398938261251; Thu, 01 May 2014 02:57:41 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.31.52 with SMTP id e49ls938220qge.19.gmail; Thu, 01 May 2014 02:57:41 -0700 (PDT) X-Received: by 10.52.142.10 with SMTP id rs10mr6796727vdb.3.1398938261164; Thu, 01 May 2014 02:57:41 -0700 (PDT) Received: from mail-vc0-f169.google.com (mail-vc0-f169.google.com [209.85.220.169]) by mx.google.com with ESMTPS id tl10si5958465vcb.211.2014.05.01.02.57.41 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 01 May 2014 02:57:41 -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.220.169; Received: by mail-vc0-f169.google.com with SMTP id im17so3635858vcb.14 for ; Thu, 01 May 2014 02:57:41 -0700 (PDT) X-Received: by 10.52.249.105 with SMTP id yt9mr584039vdc.34.1398938261097; Thu, 01 May 2014 02:57:41 -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 ib8csp12918vcb; Thu, 1 May 2014 02:57:40 -0700 (PDT) X-Received: by 10.194.92.177 with SMTP id cn17mr8261407wjb.18.1398938260212; Thu, 01 May 2014 02:57:40 -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 gb1si574719wic.60.2014.05.01.02.57.39 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 01 May 2014 02:57:40 -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 hi5so452126wib.0 for ; Thu, 01 May 2014 02:57:39 -0700 (PDT) X-Received: by 10.180.39.175 with SMTP id q15mr1579174wik.4.1398938259705; Thu, 01 May 2014 02:57:39 -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.57.38 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 01 May 2014 02:57:38 -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 16/47] mtd: nand: stm_nand_bch: add compatible page size check Date: Thu, 1 May 2014 10:56:23 +0100 Message-Id: <1398938214-17847-17-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: , 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 fdb06517..a1c25d0 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 */ @@ -921,6 +924,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; }