diff mbox series

[1/2] board: st: common: Fix board_get_alt_info_mtd()

Message ID 20231117170107.1147598-1-patrice.chotard@foss.st.com
State Accepted
Commit b40f67a63586607ce2704ae5800790d35980f39d
Delegated to: Patrice Chotard
Headers show
Series [1/2] board: st: common: Fix board_get_alt_info_mtd() | expand

Commit Message

Patrice CHOTARD Nov. 17, 2023, 5:01 p.m. UTC
Since MTD devices are partioned, we got the following
error when command "dfu 0" is executed:

DFU alt info setting: done
ERROR: Too many arguments for nor0
ERROR: DFU entities configuration failed!
ERROR: (partition table does not match dfu_alt_info?)

Fixes: 31325e1b8b9c ("stm32mp1: dynamically build DFU_ALT_INFO")

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
---

 board/st/common/stm32mp_dfu.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

Comments

Patrick Delaunay Dec. 15, 2023, 11:52 a.m. UTC | #1
Hi,

On 11/17/23 18:01, Patrice Chotard wrote:
> Since MTD devices are partioned, we got the following
> error when command "dfu 0" is executed:
>
> DFU alt info setting: done
> ERROR: Too many arguments for nor0
> ERROR: DFU entities configuration failed!
> ERROR: (partition table does not match dfu_alt_info?)
>
> Fixes: 31325e1b8b9c ("stm32mp1: dynamically build DFU_ALT_INFO")
>
> Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
> ---
>
>   board/st/common/stm32mp_dfu.c | 9 ++-------
>   1 file changed, 2 insertions(+), 7 deletions(-)
>
> diff --git a/board/st/common/stm32mp_dfu.c b/board/st/common/stm32mp_dfu.c
> index a8eb8d5cae2..ded3bf81961 100644
> --- a/board/st/common/stm32mp_dfu.c
> +++ b/board/st/common/stm32mp_dfu.c
> @@ -73,7 +73,6 @@ static void board_get_alt_info_mmc(struct udevice *dev, char *buf)
>   static void board_get_alt_info_mtd(struct mtd_info *mtd, char *buf)
>   {
>   	struct mtd_info *part;
> -	bool first = true;
>   	const char *name;
>   	int len, partnum = 0;
>   
> @@ -86,17 +85,13 @@ static void board_get_alt_info_mtd(struct mtd_info *mtd, char *buf)
>   			"mtd %s=", name);
>   
>   	len += snprintf(buf + len, DFU_ALT_BUF_LEN - len,
> -			"%s raw 0x0 0x%llx ",
> +			"%s raw 0x0 0x%llx",
>   			name, mtd->size);
>   
>   	list_for_each_entry(part, &mtd->partitions, node) {
>   		partnum++;
> -		if (!first)
> -			len += snprintf(buf + len, DFU_ALT_BUF_LEN - len, ";");
> -		first = false;
> -
>   		len += snprintf(buf + len, DFU_ALT_BUF_LEN - len,
> -				"%s_%s part %d",
> +				";%s_%s part %d",
>   				name, part->name, partnum);
>   	}
>   }



Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

Thanks
Patrick
Patrice CHOTARD Dec. 15, 2023, 2:13 p.m. UTC | #2
On 12/15/23 12:52, Patrick DELAUNAY wrote:
> Hi,
> 
> On 11/17/23 18:01, Patrice Chotard wrote:
>> Since MTD devices are partioned, we got the following
>> error when command "dfu 0" is executed:
>>
>> DFU alt info setting: done
>> ERROR: Too many arguments for nor0
>> ERROR: DFU entities configuration failed!
>> ERROR: (partition table does not match dfu_alt_info?)
>>
>> Fixes: 31325e1b8b9c ("stm32mp1: dynamically build DFU_ALT_INFO")
>>
>> Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
>> ---
>>
>>   board/st/common/stm32mp_dfu.c | 9 ++-------
>>   1 file changed, 2 insertions(+), 7 deletions(-)
>>
>> diff --git a/board/st/common/stm32mp_dfu.c b/board/st/common/stm32mp_dfu.c
>> index a8eb8d5cae2..ded3bf81961 100644
>> --- a/board/st/common/stm32mp_dfu.c
>> +++ b/board/st/common/stm32mp_dfu.c
>> @@ -73,7 +73,6 @@ static void board_get_alt_info_mmc(struct udevice *dev, char *buf)
>>   static void board_get_alt_info_mtd(struct mtd_info *mtd, char *buf)
>>   {
>>       struct mtd_info *part;
>> -    bool first = true;
>>       const char *name;
>>       int len, partnum = 0;
>>   @@ -86,17 +85,13 @@ static void board_get_alt_info_mtd(struct mtd_info *mtd, char *buf)
>>               "mtd %s=", name);
>>         len += snprintf(buf + len, DFU_ALT_BUF_LEN - len,
>> -            "%s raw 0x0 0x%llx ",
>> +            "%s raw 0x0 0x%llx",
>>               name, mtd->size);
>>         list_for_each_entry(part, &mtd->partitions, node) {
>>           partnum++;
>> -        if (!first)
>> -            len += snprintf(buf + len, DFU_ALT_BUF_LEN - len, ";");
>> -        first = false;
>> -
>>           len += snprintf(buf + len, DFU_ALT_BUF_LEN - len,
>> -                "%s_%s part %d",
>> +                ";%s_%s part %d",
>>                   name, part->name, partnum);
>>       }
>>   }
> 
> 
> 
> Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
> 
> Thanks
> Patrick
> 
Applied to u-boot-stm32/next

Thanks
Patrice
diff mbox series

Patch

diff --git a/board/st/common/stm32mp_dfu.c b/board/st/common/stm32mp_dfu.c
index a8eb8d5cae2..ded3bf81961 100644
--- a/board/st/common/stm32mp_dfu.c
+++ b/board/st/common/stm32mp_dfu.c
@@ -73,7 +73,6 @@  static void board_get_alt_info_mmc(struct udevice *dev, char *buf)
 static void board_get_alt_info_mtd(struct mtd_info *mtd, char *buf)
 {
 	struct mtd_info *part;
-	bool first = true;
 	const char *name;
 	int len, partnum = 0;
 
@@ -86,17 +85,13 @@  static void board_get_alt_info_mtd(struct mtd_info *mtd, char *buf)
 			"mtd %s=", name);
 
 	len += snprintf(buf + len, DFU_ALT_BUF_LEN - len,
-			"%s raw 0x0 0x%llx ",
+			"%s raw 0x0 0x%llx",
 			name, mtd->size);
 
 	list_for_each_entry(part, &mtd->partitions, node) {
 		partnum++;
-		if (!first)
-			len += snprintf(buf + len, DFU_ALT_BUF_LEN - len, ";");
-		first = false;
-
 		len += snprintf(buf + len, DFU_ALT_BUF_LEN - len,
-				"%s_%s part %d",
+				";%s_%s part %d",
 				name, part->name, partnum);
 	}
 }