| Message ID | 20260901-rzn1-2026-10-mtd-v1-1-516e2177cd20@linaro.org |
|---|---|
| State | New |
| Delegated to: | Tom Rini |
| Headers | show |
| Series | dfu: mtd: probe before get_mtd_device_nm() | expand |
Hi Ralph, Thank you for the patch. On Tue, Sep 01, 2026 at 11:34, Ralph Siemsen <ralph.siemsen@linaro.org> wrote: > Parsing dfu_alt_info depends on matching MTD device names, so it is > necessary for all MTD devices to be probed first. Move the existing > call to mtd_probe_devices() accordingly. > > This fixes a failure of the "dfu usb" command that occurs when: > - dfu_alt_info contains SF devices listed as via MTD > - there is no persistent environment stored in SF > - "sf probe" has not been executed prior to "dfu usb" > > Signed-off-by: Ralph Siemsen <ralph.siemsen@linaro.org> Reviewed-by: Mattijs Korpershoek <mkorpershoek@kernel.org> > ---
diff --git a/drivers/dfu/dfu_mtd.c b/drivers/dfu/dfu_mtd.c index c36ac09189f..da19bc21492 100644 --- a/drivers/dfu/dfu_mtd.c +++ b/drivers/dfu/dfu_mtd.c @@ -289,6 +289,9 @@ int dfu_fill_entity_mtd(struct dfu_entity *dfu, char *devstr, char **argv, int a struct mtd_info *mtd; int part; + /* register partitions with MTDIDS/MTDPARTS or OF fallback */ + mtd_probe_devices(); + mtd = get_mtd_device_nm(devstr); if (IS_ERR_OR_NULL(mtd)) return -ENODEV; @@ -324,9 +327,6 @@ int dfu_fill_entity_mtd(struct dfu_entity *dfu, char *devstr, char **argv, int a if (*s) return -EINVAL; - /* register partitions with MTDIDS/MTDPARTS or OF fallback */ - mtd_probe_devices(); - partnum = 0; list_for_each_entry(partition, &mtd->partitions, node) { partnum++;
Parsing dfu_alt_info depends on matching MTD device names, so it is necessary for all MTD devices to be probed first. Move the existing call to mtd_probe_devices() accordingly. This fixes a failure of the "dfu usb" command that occurs when: - dfu_alt_info contains SF devices listed as via MTD - there is no persistent environment stored in SF - "sf probe" has not been executed prior to "dfu usb" Signed-off-by: Ralph Siemsen <ralph.siemsen@linaro.org> --- drivers/dfu/dfu_mtd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- base-commit: 964ad5b5c91b7be56e443e899d7f873e6aa8c9fc change-id: 20260901-rzn1-2026-10-mtd-856065fbc00c Best regards, -- Ralph Siemsen <ralph.siemsen@linaro.org>