--- a/drivers/mtd/nand/spi/core.c +++ b/drivers/mtd/nand/spi/core.c @@ -19,6 +19,7 @@ #include #include #include +#include static int spinand_read_reg_op(struct spinand_device *spinand, u8 reg, u8 *val) { @@ -1332,6 +1333,7 @@ static int spinand_probe(struct spi_mem if (ret) return ret; + mtk_bmt_attach(mtd); ret = mtd_device_register(mtd, NULL, 0); if (ret) goto err_spinand_cleanup; @@ -1339,6 +1341,7 @@ static int spinand_probe(struct spi_mem return 0; err_spinand_cleanup: + mtk_bmt_detach(mtd); spinand_cleanup(spinand); return ret; @@ -1357,6 +1360,7 @@ static int spinand_remove(struct spi_mem if (ret) return ret; + mtk_bmt_detach(mtd); spinand_cleanup(spinand); return 0;