diff mbox series

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

Message ID 20260816163058.10099-1-kmehltretter@gmail.com
State New
Headers show
Series mtd: core: call _get_device() with the master MTD | expand

Commit Message

Karl Mehltretter Aug. 16, 2026, 4:30 p.m. UTC
__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
Signed-off-by: Karl Mehltretter <kmehltretter@gmail.com>
---
 drivers/mtd/mtdcore.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


base-commit: 3eb40771c00a8488fa6ed2cc1fe203477908bf38

Comments

Miquel Raynal Sept. 4, 2026, 5:38 p.m. UTC | #1
On Sun, 16 Aug 2026 18:30:58 +0200, Karl Mehltretter wrote:
> __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
diff mbox series

Patch

diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
index 16629382a787b..ab840922b5b1 100644
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@ -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;
 	}