All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] stm32prog: add partition name in treat_partition_list error messages
@ 2022-01-18  9:33 Patrick Delaunay
  2022-01-21  7:19 ` Patrice CHOTARD
  2022-01-24 12:17 ` Patrice CHOTARD
  0 siblings, 2 replies; 3+ messages in thread
From: Patrick Delaunay @ 2022-01-18  9:33 UTC (permalink / raw)
  To: u-boot
  Cc: Patrick Delaunay, Jaehoon Chung, Patrice Chotard, Simon Glass,
	uboot-stm32

Add the partition name and remove the line number in error messages
of treat_partition_list() to provide correct information to user of
STM32CubeProgrammer.

The "line number" value was confusing because it is incorrect here;
the index in  part_array[] is not aligned with the line number in
the parsed Layout file, because the empty lines and the lines beginning
by '#' are skipped during the first parsing in parse_flash_layout().

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

 arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c
index 3b6ca4e773..61cba157fd 100644
--- a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c
+++ b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c
@@ -835,8 +835,8 @@ static int treat_partition_list(struct stm32prog_data *data)
 		/* skip partition with IP="none" */
 		if (part->target == STM32PROG_NONE) {
 			if (IS_SELECT(part)) {
-				stm32prog_err("Layout: selected none phase = 0x%x",
-					      part->id);
+				stm32prog_err("Layout: selected none phase = 0x%x for part %s",
+					      part->id, part->name);
 				return -EINVAL;
 			}
 			continue;
@@ -844,14 +844,14 @@ static int treat_partition_list(struct stm32prog_data *data)
 
 		if (part->id == PHASE_FLASHLAYOUT ||
 		    part->id > PHASE_LAST_USER) {
-			stm32prog_err("Layout: invalid phase = 0x%x",
-				      part->id);
+			stm32prog_err("Layout: invalid phase = 0x%x for part %s",
+				      part->id, part->name);
 			return -EINVAL;
 		}
 		for (j = i + 1; j < data->part_nb; j++) {
 			if (part->id == data->part_array[j].id) {
-				stm32prog_err("Layout: duplicated phase 0x%x at line %d and %d",
-					      part->id, i, j);
+				stm32prog_err("Layout: duplicated phase 0x%x for part %s and %s",
+					      part->id, part->name, data->part_array[j].name);
 				return -EINVAL;
 			}
 		}
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] stm32prog: add partition name in treat_partition_list error messages
  2022-01-18  9:33 [PATCH] stm32prog: add partition name in treat_partition_list error messages Patrick Delaunay
@ 2022-01-21  7:19 ` Patrice CHOTARD
  2022-01-24 12:17 ` Patrice CHOTARD
  1 sibling, 0 replies; 3+ messages in thread
From: Patrice CHOTARD @ 2022-01-21  7:19 UTC (permalink / raw)
  To: Patrick Delaunay, u-boot; +Cc: Jaehoon Chung, Simon Glass, uboot-stm32

HI Patrick

On 1/18/22 10:33 AM, Patrick Delaunay wrote:
> Add the partition name and remove the line number in error messages
> of treat_partition_list() to provide correct information to user of
> STM32CubeProgrammer.
> 
> The "line number" value was confusing because it is incorrect here;
> the index in  part_array[] is not aligned with the line number in
> the parsed Layout file, because the empty lines and the lines beginning
> by '#' are skipped during the first parsing in parse_flash_layout().
> 
> Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
> ---
> 
>  arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c
> index 3b6ca4e773..61cba157fd 100644
> --- a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c
> +++ b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c
> @@ -835,8 +835,8 @@ static int treat_partition_list(struct stm32prog_data *data)
>  		/* skip partition with IP="none" */
>  		if (part->target == STM32PROG_NONE) {
>  			if (IS_SELECT(part)) {
> -				stm32prog_err("Layout: selected none phase = 0x%x",
> -					      part->id);
> +				stm32prog_err("Layout: selected none phase = 0x%x for part %s",
> +					      part->id, part->name);
>  				return -EINVAL;
>  			}
>  			continue;
> @@ -844,14 +844,14 @@ static int treat_partition_list(struct stm32prog_data *data)
>  
>  		if (part->id == PHASE_FLASHLAYOUT ||
>  		    part->id > PHASE_LAST_USER) {
> -			stm32prog_err("Layout: invalid phase = 0x%x",
> -				      part->id);
> +			stm32prog_err("Layout: invalid phase = 0x%x for part %s",
> +				      part->id, part->name);
>  			return -EINVAL;
>  		}
>  		for (j = i + 1; j < data->part_nb; j++) {
>  			if (part->id == data->part_array[j].id) {
> -				stm32prog_err("Layout: duplicated phase 0x%x at line %d and %d",
> -					      part->id, i, j);
> +				stm32prog_err("Layout: duplicated phase 0x%x for part %s and %s",
> +					      part->id, part->name, data->part_array[j].name);
>  				return -EINVAL;
>  			}
>  		}
> 

Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Thanks
Patrice

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] stm32prog: add partition name in treat_partition_list error messages
  2022-01-18  9:33 [PATCH] stm32prog: add partition name in treat_partition_list error messages Patrick Delaunay
  2022-01-21  7:19 ` Patrice CHOTARD
@ 2022-01-24 12:17 ` Patrice CHOTARD
  1 sibling, 0 replies; 3+ messages in thread
From: Patrice CHOTARD @ 2022-01-24 12:17 UTC (permalink / raw)
  To: Patrick Delaunay, u-boot; +Cc: Jaehoon Chung, Simon Glass, uboot-stm32

Hi Patrick

On 1/18/22 10:33, Patrick Delaunay wrote:
> Add the partition name and remove the line number in error messages
> of treat_partition_list() to provide correct information to user of
> STM32CubeProgrammer.
> 
> The "line number" value was confusing because it is incorrect here;
> the index in  part_array[] is not aligned with the line number in
> the parsed Layout file, because the empty lines and the lines beginning
> by '#' are skipped during the first parsing in parse_flash_layout().
> 
> Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
> ---
> 
>  arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c
> index 3b6ca4e773..61cba157fd 100644
> --- a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c
> +++ b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c
> @@ -835,8 +835,8 @@ static int treat_partition_list(struct stm32prog_data *data)
>  		/* skip partition with IP="none" */
>  		if (part->target == STM32PROG_NONE) {
>  			if (IS_SELECT(part)) {
> -				stm32prog_err("Layout: selected none phase = 0x%x",
> -					      part->id);
> +				stm32prog_err("Layout: selected none phase = 0x%x for part %s",
> +					      part->id, part->name);
>  				return -EINVAL;
>  			}
>  			continue;
> @@ -844,14 +844,14 @@ static int treat_partition_list(struct stm32prog_data *data)
>  
>  		if (part->id == PHASE_FLASHLAYOUT ||
>  		    part->id > PHASE_LAST_USER) {
> -			stm32prog_err("Layout: invalid phase = 0x%x",
> -				      part->id);
> +			stm32prog_err("Layout: invalid phase = 0x%x for part %s",
> +				      part->id, part->name);
>  			return -EINVAL;
>  		}
>  		for (j = i + 1; j < data->part_nb; j++) {
>  			if (part->id == data->part_array[j].id) {
> -				stm32prog_err("Layout: duplicated phase 0x%x at line %d and %d",
> -					      part->id, i, j);
> +				stm32prog_err("Layout: duplicated phase 0x%x for part %s and %s",
> +					      part->id, part->name, data->part_array[j].name);
>  				return -EINVAL;
>  			}
>  		}
Applied to u-boot-stm/master

Thanks
Patrice

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-01-24 12:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-18  9:33 [PATCH] stm32prog: add partition name in treat_partition_list error messages Patrick Delaunay
2022-01-21  7:19 ` Patrice CHOTARD
2022-01-24 12:17 ` Patrice CHOTARD

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.