[PATCH v3 3/3] mtd: mtdpart: fix partitions searching

Quentin Schulz quentin.schulz at cherry.de
Tue Jan 20 11:10:07 CET 2026


Hi Mikhail,

On 1/19/26 11:33 PM, Mikhail Kshevetskiy wrote:
> mtdpart internally enumerate partitions starting from zero, but partition
> driver API enumerate partitions starting from 1, so wrong partition will
> be queried. This is wrong.
> 

Are you sure this is the only place we need to fix that?

Do mtd_parse_partitions, mtd_add_partition, mtd_del_partitions, 
add_mtd_partitions work as intended? They seem to also be using 
0-starting indices... There's probably some mixing up between a device 
index (0-starting?) and a partition index (1-starting) I guess?

Would be nice if we could have some tests in test/ so that 1) we know it 
works as expected, 2) we avoid regressions in the future?

Also in v2 you said not many devices do have both MTD_PARTITIONS and 
MTD_BLOCK enabled but I don't understand where MTD_BLOCK is required. 
Are we missing a symbol dependency somewhere?

Cheers,
Quentin


More information about the U-Boot mailing list