From patchwork Tue Mar 25 08:20:04 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 26979 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f69.google.com (mail-qa0-f69.google.com [209.85.216.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 2DC1D20062 for ; Tue, 25 Mar 2014 08:22:30 +0000 (UTC) Received: by mail-qa0-f69.google.com with SMTP id w5sf260514qac.8 for ; Tue, 25 Mar 2014 01:22:30 -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:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=+kMqVx5WPGAl/qKfJsVDKqwG/2ODk2BFdaIvXelDOsw=; b=Ki82/DRX9oFKKL1BufX0B8P9KE9GkuJVMblGBdZswOoby5HFYvqk2nz1MxtlGFtVJq 4nKJMTF1vlhi12/Zh8tiXwyPH2zuLXgWcOTi4FeHK67LU5ZPAJPntB7s+Ws5aE9dNB4E QfThvAFAnlZHK/sSplBUM8O51faRbYsBvMEI/CV+ozjMaXyK6u9mg7/NkCBknuxwluUm Kfh0+FB3dsaribdjOIXIlKNG/kKRMkcgMRyqXoAKGT5cRZK4pwvlb/Nz751iQVKlnM7K tKhBpjzQNhIQoxS6EbfgNcym6VWLvCtXyJgYlcaB4U3kID0uwIAAqQf7j9G1NgnbdiYA 2wfg== X-Gm-Message-State: ALoCoQkbZVka8YVG3zl+hjdLdiRUZPphomEe5XLqTS5tImvBvAUv6i9iuazk1+J50aOT1HgaF//b X-Received: by 10.236.90.200 with SMTP id e48mr20695915yhf.28.1395735749961; Tue, 25 Mar 2014 01:22:29 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.50.81 with SMTP id r75ls102231qga.71.gmail; Tue, 25 Mar 2014 01:22:29 -0700 (PDT) X-Received: by 10.58.220.161 with SMTP id px1mr55342338vec.13.1395735749889; Tue, 25 Mar 2014 01:22:29 -0700 (PDT) Received: from mail-ve0-f171.google.com (mail-ve0-f171.google.com [209.85.128.171]) by mx.google.com with ESMTPS id p4si3591475vem.30.2014.03.25.01.22.29 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 25 Mar 2014 01:22:29 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.171 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.171; Received: by mail-ve0-f171.google.com with SMTP id cz12so130920veb.30 for ; Tue, 25 Mar 2014 01:22:29 -0700 (PDT) X-Received: by 10.52.164.237 with SMTP id yt13mr23924232vdb.18.1395735749815; Tue, 25 Mar 2014 01:22:29 -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 i9csp285359vck; Tue, 25 Mar 2014 01:22:28 -0700 (PDT) X-Received: by 10.68.203.135 with SMTP id kq7mr76393219pbc.85.1395735748534; Tue, 25 Mar 2014 01:22:28 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id fa7si11029164pab.237.2014.03.25.01.22.27; Tue, 25 Mar 2014 01:22:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753424AbaCYIWO (ORCPT + 26 others); Tue, 25 Mar 2014 04:22:14 -0400 Received: from mail-wg0-f43.google.com ([74.125.82.43]:65291 "EHLO mail-wg0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753285AbaCYIVu (ORCPT ); Tue, 25 Mar 2014 04:21:50 -0400 Received: by mail-wg0-f43.google.com with SMTP id x13so79621wgg.2 for ; Tue, 25 Mar 2014 01:21:49 -0700 (PDT) X-Received: by 10.180.82.37 with SMTP id f5mr20014575wiy.6.1395735709108; Tue, 25 Mar 2014 01:21:49 -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.21.46 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 25 Mar 2014 01:21:48 -0700 (PDT) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: lee.jones@linaro.org, kernel@stlinux.com, computersforpeace@gmail.com, linux-mtd@lists.infradead.org, dwmw2@infradead.org, angus.clark@st.com, pekon@ti.com Subject: [RFC 47/47] mtd: nand: stm_nand_bch: catch unsupported calls Date: Tue, 25 Mar 2014 08:20:04 +0000 Message-Id: <1395735604-26706-48-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> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.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.128.171 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 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Display a BUG() message and return appropriate/expected value. Signed-off-by: Lee Jones --- drivers/mtd/nand/stm_nand_bch.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/drivers/mtd/nand/stm_nand_bch.c b/drivers/mtd/nand/stm_nand_bch.c index 4103d4f..e732bf3 100644 --- a/drivers/mtd/nand/stm_nand_bch.c +++ b/drivers/mtd/nand/stm_nand_bch.c @@ -852,6 +852,31 @@ static void flex_write_buf(struct mtd_info *mtd, const uint8_t *buf, int len) } } +/* Catch calls to non-supported functions */ +static uint16_t flex_read_word_bug(struct mtd_info *mtd) +{ + BUG(); + return 0; +} + +static int flex_block_bad_bug(struct mtd_info *mtd, loff_t ofs, int getchip) +{ + BUG(); + return 1; +} + +static int flex_block_markbad_bug(struct mtd_info *mtd, loff_t ofs) +{ + BUG(); + return 1; +} + +int flex_scan_bbt_bug(struct mtd_info *mtd) +{ + BUG(); + return 1; +} + /* * Hamming-FLEX operations (optimised replacements for nand_base.c versions) */ @@ -1916,7 +1941,12 @@ static void nandi_set_mtd_defaults(struct nandi_controller *nandi, chip->read_buf = flex_read_buf; chip->write_buf = flex_write_buf; + chip->read_word = flex_read_word_bug; + chip->block_bad = flex_block_bad_bug; + chip->block_markbad = flex_block_markbad_bug; + chip->bbt_options |= NAND_BBT_USE_FLASH; + chip->scan_bbt = flex_scan_bbt_bug; /* mtd_info */ mtd->owner = THIS_MODULE;