Skip to contentSkip to conversation

mtd: core: call _get_device() with the master MTD

PATCH Applied Karl Mehltretter 2 participants 2 messages Aug 16 – Sep 4 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mtd: core: call _get_device() with the master MTD

__get_mtd_device() calls the master's _get_device() callback with mtd, which may be a partition. __put_mtd_device() passes the master.

This breaks gluebi partitions because gluebi_get_device() uses container_of() and therefore requires the master MTD. Pass the master to _get_device(), matching _put_device().

Fixes 46b5889cc2c5 ("mtd: implement proper partition handling")
Assisted-by Codex:gpt-5.6-sol
---
 drivers/mtd/mtdcore.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/mtdcore.c +1 -1
index 16629382a787b..ab840922b5b1 100644
@@ -1333,7 +1333,7 @@ int __get_mtd_device(struct mtd_info *mtd)
 	int err;
 
 	if (master->_get_device) {
-		err = master->_get_device(mtd);
+		err = master->_get_device(master);
 		if (err)
 			return err;
 	}

base-commit: 3eb40771c00a8488fa6ed2cc1fe203477908bf38

Signature · 1 line
2.53.0
maintainer Applied
#1 lore raw
Quoted 8 lines · Karl Mehltretter

__get_mtd_device() calls the master's _get_device() callback with mtd, which may be a partition. __put_mtd_device() passes the master.

This breaks gluebi partitions because gluebi_get_device() uses container_of() and therefore requires the master MTD. Pass the master to _get_device(), matching _put_device().

[...]

Applied to mtd/fixes, thanks!

[1/1] mtd: core: call _get_device() with the master MTD

      commit: 12b31d1acd20b3185bb5f0748db0cf6874c8e9d1

Patche(s) should be available on mtd/linux.git and will be part of the next PR (provided that no robot complains by then).

Kind regards,
Miquèl