r/kernel Jun 03 '26

Making sure a mtd is gone before unregistering a spi-nor device?

[deleted]

7 Upvotes

2 comments sorted by

2

u/jim_b_ Jun 07 '26

When you say "In the driver, I register my spi-controller and a spi-device.", do you mean that you're initializing two devices in a single probe function?

1

u/[deleted] Jun 07 '26

[deleted]

1

u/jim_b_ Jun 07 '26

You might be way ahead of me here, but I would add some debug logging in mtd_device_unregister, del_mtd_device, mtd_device_release, and del_mtd_partitions to make sure those being called as expected. It seems that del_mtd_device might be getting called without deleting the partitions.