summaryrefslogtreecommitdiff
path: root/drivers/mtd
diff options
context:
space:
mode:
authorTom Rini <[email protected]>2026-02-04 10:31:02 -0600
committerTom Rini <[email protected]>2026-02-04 10:31:02 -0600
commite7a21a985da632fcaaed1cf7b90f6c025fcb389f (patch)
treec0fc6d85e7760d79c00ddca0148ef25d53674abb /drivers/mtd
parenteb1562cc3e4c5130c76db1c1ea57156322362a7c (diff)
parentb06a1785b2bbe489a634e3158f82f93491a84328 (diff)
Merge patch series "part: fix partition searching"
Mikhail Kshevetskiy <[email protected]> says: It was noted that a GPT partition with the maximum available partition number (ex: /dev/mmcblk128) can't be read/write from U-Boot using read/write commands. Futher investigation shows that the problem is deeper. This set of patches fixes uncovered issues. Link: https://lore.kernel.org/r/[email protected]
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/mtdpart.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
index 842d3e7274e..f3b7f1ee13c 100644
--- a/drivers/mtd/mtdpart.c
+++ b/drivers/mtd/mtdpart.c
@@ -1061,13 +1061,13 @@ EXPORT_SYMBOL_GPL(mtd_get_device_size);
static struct mtd_info *mtd_get_partition_by_index(struct mtd_info *mtd, int index)
{
struct mtd_info *part;
- int i = 0;
+ int i = 1;
+ /* partition indexes starts from 1 */
list_for_each_entry(part, &mtd->partitions, node)
if (i++ == index)
return part;
- debug("Partition with idx=%d not found on MTD device %s\n", index, mtd->name);
return NULL;
}
@@ -1084,7 +1084,8 @@ static int __maybe_unused part_get_info_mtd(struct blk_desc *dev_desc, int part_
part = mtd_get_partition_by_index(master, part_idx);
if (!part) {
- debug("Failed to find partition with idx=%d\n", part_idx);
+ debug("Failed to find partition with idx=%d on MTD device %s\n",
+ part_idx, master->name);
return -EINVAL;
}