mtd: WARNING: CPU: 0 PID: 1 at del_gendisk+0x27c/0x2fc

Rafał Miłecki zajec5 at gmail.com
Tue Jul 18 09:53:30 PDT 2023


I've noticed a following WARNING with Linux 6.1.38. It seems harmless
but probably should be taken care of. I'm not familiar with blktrans.
Any volunteers? :)


[    0.592614] nand: device found, Manufacturer ID: 0x01, Chip ID: 0xdc
[    0.599135] nand: AMD/Spansion NAND 512MiB 3,3V 8-bit
[    0.604338] nand: 512 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
[    0.612144] bcm63138_nand ff801800.nand-controller: detected 512MiB total, 128KiB blocks, 2KiB pages, 16B OOB, 8-bit, BCH-4
[    0.624870] Bad block table found at page 262080, version 0x01
[    0.632759] Bad block table found at page 262016, version 0x01
[    0.639200] 2 cmdlinepart partitions found on MTD device brcmnand.0
[    0.645580] Creating 2 MTD partitions on "brcmnand.0":
[    0.650877] 0x000000000000-0x000000100000 : "loader"
[    0.687209] offset:0x40000 magic:0x75456e76 BINGO
[    0.743290] offset:0xac000 magic:0x75456e76 BINGO
[    0.748051] 2 brcm_u-boot partitions found on MTD device loader
[    0.754149] Creating 2 MTD partitions on "loader":
[    0.759072] 0x000000040000-0x000000044008 : "u-boot-env"
[    0.764540] mtd: partition "u-boot-env" doesn't end on an erase/write block -- force read-only
[    0.773565] mtd mtd1: Failed to register NVMEM device: -517
[    0.779278] Deleting MTD partitions on "brcmnand.0":
[    0.784337] Deleting loader MTD partition
[    0.788452] [del_mtd_device] Calling not->remove: blktrans_notify_remove
[    0.795372] ------------[ cut here ]------------
[    0.800098] WARNING: CPU: 0 PID: 1 at del_gendisk+0x27c/0x2fc
[    0.806013] Modules linked in:
[    0.809150] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 6.1.38 #0
[    0.815240] Hardware name: Luxul RT-20 (DT)
[    0.819543] pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[    0.826710] pc : del_gendisk+0x27c/0x2fc
[    0.830742] lr : del_mtd_blktrans_dev+0x34/0x1bc
[    0.835490] sp : ffffffc00802b6d0
[    0.838896] x29: ffffffc00802b6d0 x28: 0000000000000000 x27: ffffff8000f62548
[    0.846242] x26: ffffffc008a408a0 x25: ffffffc0088497f0 x24: ffffffc008849818
[    0.853589] x23: ffffffc008a40a20 x22: ffffff80014e64a0 x21: ffffff80014db000
[    0.860936] x20: ffffff8000c61600 x19: ffffff8001604700 x18: 000000000000006c
[    0.868285] x17: 0000000025d6171a x16: 0000000023ac72e8 x15: ffffffc0089b8898
[    0.875631] x14: 0000000000000144 x13: 000000000000006c x12: 00000000ffffffea
[    0.882978] x11: 00000000ffffefff x10: ffffffc008a10898 x9 : ffffffc0089b8840
[    0.890325] x8 : 0000000000017fe8 x7 : c0000000ffffefff x6 : 0000000000057fa8
[    0.897673] x5 : 0000000000000fff x4 : 0000000000000000 x3 : ffffffc00802b560
[    0.905020] x2 : ffffffc0089b87f0 x1 : 0000000000000000 x0 : 0000000000000004
[    0.912369] Call trace:
[    0.914877]  del_gendisk+0x27c/0x2fc
[    0.918549]  del_mtd_blktrans_dev+0x34/0x1bc
[    0.922941]  mtdblock_remove_dev+0x10/0x20
[    0.927151]  blktrans_notify_remove+0x88/0xd0
[    0.931631]  del_mtd_device+0x124/0x150
[    0.935573]  __del_mtd_partitions+0x94/0x110
[    0.939965]  del_mtd_partitions+0x48/0x70
[    0.944086]  add_mtd_partitions+0xa0/0x1c0
[    0.948296]  parse_mtd_partitions+0x470/0x4c0
[    0.952777]  add_mtd_partitions+0x190/0x1c0
[    0.957078]  parse_mtd_partitions+0x470/0x4c0
[    0.961558]  mtd_device_parse_register+0xe8/0x2e0
[    0.966396]  brcmnand_init_cs+0x180/0x200
[    0.970517]  brcmnand_probe+0x830/0xd20
[    0.974459]  bcm63138_nand_probe+0x80/0xa0
[    0.978671]  platform_probe+0x68/0xc0
[    0.982435]  really_probe+0xbc/0x2dc
[    0.986108]  __driver_probe_device+0x78/0x120
[    0.990588]  driver_probe_device+0x40/0x120
[    0.994888]  __driver_attach+0x94/0x19c
[    0.998831]  bus_for_each_dev+0x60/0xa0
[    1.002774]  driver_attach+0x24/0x30
[    1.006447]  bus_add_driver+0x154/0x20c
[    1.010389]  driver_register+0x78/0x130
[    1.014331]  __platform_driver_register+0x28/0x34
[    1.019170]  bcm63138_nand_driver_init+0x1c/0x28
[    1.023920]  do_one_initcall+0x50/0x1d0
[    1.027862]  kernel_init_freeable+0x234/0x298
[    1.032342]  kernel_init+0x28/0x130
[    1.035926]  ret_from_fork+0x10/0x20
[    1.039599] ---[ end trace 0000000000000000 ]---
[    1.044438] [del_mtd_device] Done
[    1.047892] Failed to parse subpartitions: -517
[    1.052482] Deleting MTD partitions on "brcmnand.0":


diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
index 35a7adad4..03f4d844e 100644
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@ -557,7 +557,7 @@ static int mtd_nvmem_add(struct mtd_info *mtd)
  		if (PTR_ERR(mtd->nvmem) == -EOPNOTSUPP) {
  			mtd->nvmem = NULL;
  		} else {
-			dev_err(&mtd->dev, "Failed to register NVMEM device\n");
+			dev_err(&mtd->dev, "Failed to register NVMEM device: %ld\n", PTR_ERR(mtd->nvmem));
  			return PTR_ERR(mtd->nvmem);
  		}
  	}
@@ -810,8 +810,11 @@ int del_mtd_device(struct mtd_info *mtd)

  	/* No need to get a refcount on the module containing
  		the notifier, since we hold the mtd_table_mutex */
-	list_for_each_entry(not, &mtd_notifiers, list)
+	list_for_each_entry(not, &mtd_notifiers, list) {
+		pr_info("[%s] Calling not->remove: %ps\n", __func__, not->remove);
  		not->remove(mtd);
+		pr_info("[%s] Done\n", __func__);
+	}

  	if (mtd->usecount) {
  		printk(KERN_NOTICE "Removing MTD device #%d (%s) with use count %d\n",



More information about the linux-mtd mailing list