From cc8579cc0cb6b4797b72e99347ad625eb6a0adeb Mon Sep 17 00:00:00 2001 From: Patrice Chotard Date: Fri, 29 Nov 2024 13:27:07 +0100 Subject: arm: stm32mp: stm32prog: fix warning when CONFIG_SYS_64BIT_LBA is enable If CONFIG_SYS_64BIT_LBA flag is enable, following warning is triggered: ../arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c: In function 'init_device': ../arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c:793:27: warning: format '%ld' expects argument of type 'long int', but argument 8 has type 'lbaint_t' {aka 'long long unsigned int'} [-Wformat=] 793 | log_debug("MMC %d: lba=%ld blksz=%ld\n", dev->dev_id, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../include/log.h:157:21: note: in definition of macro 'pr_fmt' 157 | #define pr_fmt(fmt) fmt | ^~~ ../include/log.h:182:33: note: in expansion of macro 'log' 182 | #define log_debug(_fmt...) log(LOG_CATEGORY, LOGL_DEBUG, ##_fmt) | ^~~ ../arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c:793:17: note: in expansion of macro 'log_debug' 793 | log_debug("MMC %d: lba=%ld blksz=%ld\n", dev->dev_id, | ^~~~~~~~~ ../arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c:793:42: note: format string is defined here 793 | log_debug("MMC %d: lba=%ld blksz=%ld\n", dev->dev_id, | ~~^ | | | long int | %lld Cast block_dev->lba to u64 and set the length specifier to %lld which is ok with or without CONFIG_SYS_64BIT_LBA flag. Signed-off-by: Patrice Chotard Reviewed-by: Patrick Delaunay --- arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c') diff --git a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c index 393f9a1b411..f0e019e8da1 100644 --- a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c +++ b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c @@ -790,8 +790,8 @@ static int init_device(struct stm32prog_data *data, last_addr = (u64)(block_dev->lba - GPT_HEADER_SZ - 1) * block_dev->blksz; } - log_debug("MMC %d: lba=%ld blksz=%ld\n", dev->dev_id, - block_dev->lba, block_dev->blksz); + log_debug("MMC %d: lba=%lld blksz=%ld\n", dev->dev_id, + (u64)block_dev->lba, block_dev->blksz); log_debug(" available address = 0x%llx..0x%llx\n", first_addr, last_addr); log_debug(" full_update = %d\n", dev->full_update); -- cgit v1.2.3 From 2d774c19f23f2d8e698307d8ec136fbff6919eaf Mon Sep 17 00:00:00 2001 From: Patrice Chotard Date: Fri, 29 Nov 2024 13:27:08 +0100 Subject: arm: stm32mp: stm32prog: update multiplier is part-size is above SZ_1G Set multiplier to 'G' if part->size if above SZ_1G. Signed-off-by: Patrice Chotard Reviewed-by: Patrick Delaunay --- arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c') diff --git a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c index f0e019e8da1..353aecc09de 100644 --- a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c +++ b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c @@ -1229,7 +1229,10 @@ static int stm32prog_alt_add(struct stm32prog_data *data, char multiplier, type; /* max 3 digit for sector size */ - if (part->size > SZ_1M) { + if (part->size > SZ_1G) { + size = (u32)(part->size / SZ_1G); + multiplier = 'G'; + } else if (part->size > SZ_1M) { size = (u32)(part->size / SZ_1M); multiplier = 'M'; } else if (part->size > SZ_1K) { -- cgit v1.2.3