aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEzequiel GarcĂ­a <ezequiel@vanguardiasur.com.ar>2016-04-01 17:29:23 -0400
committerBrian Norris <computersforpeace@gmail.com>2016-04-03 02:03:51 -0400
commit20c07a5bf094198ff2382aa5e7c930b3c9807792 (patch)
tree9e38aa340a4a570c79d21b822eafec67df13eb36
parentf55532a0c0b8bb6148f4e07853b876ef73bc69ca (diff)
mtd: nand: Drop mtd.owner requirement in nand_scan
Since commit 807f16d4db95 ("mtd: core: set some defaults when dev.parent is set"), it's now legal for drivers to call nand_scan and nand_scan_ident without setting mtd.owner. Drop the check and while at it remove the BUG() abuse. Fixes: 807f16d4db95 ("mtd: core: set some defaults when dev.parent is set") Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar> Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com> [Brian: editorial note - while commit 807f16d4db95 wasn't explicitly broken, some follow-up commits in the v4.4 release broke a few drivers, since they would hit this BUG() if they used nand_scan() and were built as modules] Signed-off-by: Brian Norris <computersforpeace@gmail.com>
-rw-r--r--drivers/mtd/nand/nand_base.c10
1 files changed, 1 insertions, 9 deletions
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index b6facac54fc0..557b8462f55e 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -4009,7 +4009,6 @@ static int nand_dt_init(struct nand_chip *chip)
4009 * This is the first phase of the normal nand_scan() function. It reads the 4009 * This is the first phase of the normal nand_scan() function. It reads the
4010 * flash ID and sets up MTD fields accordingly. 4010 * flash ID and sets up MTD fields accordingly.
4011 * 4011 *
4012 * The mtd->owner field must be set to the module of the caller.
4013 */ 4012 */
4014int nand_scan_ident(struct mtd_info *mtd, int maxchips, 4013int nand_scan_ident(struct mtd_info *mtd, int maxchips,
4015 struct nand_flash_dev *table) 4014 struct nand_flash_dev *table)
@@ -4429,19 +4428,12 @@ EXPORT_SYMBOL(nand_scan_tail);
4429 * 4428 *
4430 * This fills out all the uninitialized function pointers with the defaults. 4429 * This fills out all the uninitialized function pointers with the defaults.
4431 * The flash ID is read and the mtd/chip structures are filled with the 4430 * The flash ID is read and the mtd/chip structures are filled with the
4432 * appropriate values. The mtd->owner field must be set to the module of the 4431 * appropriate values.
4433 * caller.
4434 */ 4432 */
4435int nand_scan(struct mtd_info *mtd, int maxchips) 4433int nand_scan(struct mtd_info *mtd, int maxchips)
4436{ 4434{
4437 int ret; 4435 int ret;
4438 4436
4439 /* Many callers got this wrong, so check for it for a while... */
4440 if (!mtd->owner && caller_is_module()) {
4441 pr_crit("%s called with NULL mtd->owner!\n", __func__);
4442 BUG();
4443 }
4444
4445 ret = nand_scan_ident(mtd, maxchips, NULL); 4437 ret = nand_scan_ident(mtd, maxchips, NULL);
4446 if (!ret) 4438 if (!ret)
4447 ret = nand_scan_tail(mtd); 4439 ret = nand_scan_tail(mtd);