[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1395735604-26706-48-git-send-email-lee.jones@linaro.org>
Date: Tue, 25 Mar 2014 08:20:04 +0000
From: Lee Jones <lee.jones@...aro.org>
To: linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Cc: lee.jones@...aro.org, kernel@...inux.com,
computersforpeace@...il.com, linux-mtd@...ts.infradead.org,
dwmw2@...radead.org, angus.clark@...com, pekon@...com
Subject: [RFC 47/47] mtd: nand: stm_nand_bch: catch unsupported calls
Display a BUG() message and return appropriate/expected value.
Signed-off-by: Lee Jones <lee.jones@...aro.org>
---
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;
--
1.8.3.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists