[PATCH] perf/arm-cmn: Fix resource_size_t printk specifier in arm_cmn_init_dtc()

Nathan Chancellor posted 1 patch 1 week ago
drivers/perf/arm-cmn.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] perf/arm-cmn: Fix resource_size_t printk specifier in arm_cmn_init_dtc()
Posted by Nathan Chancellor 1 week ago
When building for 32-bit ARM, there is a warning when using the %llx
specifier to print a resource_size_t variable:

  drivers/perf/arm-cmn.c: In function 'arm_cmn_init_dtc':
  drivers/perf/arm-cmn.c:2149:73: error: format '%llx' expects argument of type 'long long unsigned int', but argument 4 has type 'resource_size_t' {aka 'unsigned int'} [-Werror=format=]
   2149 |                                      "Failed to request DTC region 0x%llx\n", base);
        |                                                                      ~~~^     ~~~~
        |                                                                         |     |
        |                                                                         |     resource_size_t {aka unsigned int}
        |                                                                         long long unsigned int
        |                                                                      %x

Use the %pa specifier to handle the possible sizes of phys_addr_t
properly. This requires passing the variable by reference.

Fixes: 5394396ff548 ("perf/arm-cmn: Stop claiming entire iomem region")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
 drivers/perf/arm-cmn.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/perf/arm-cmn.c b/drivers/perf/arm-cmn.c
index 1ac91cda6780..5c727c2abaf0 100644
--- a/drivers/perf/arm-cmn.c
+++ b/drivers/perf/arm-cmn.c
@@ -2146,7 +2146,7 @@ static int arm_cmn_init_dtc(struct arm_cmn *cmn, struct arm_cmn_node *dn, int id
 	size = cmn->part == PART_CMN600 ? SZ_16K : SZ_64K;
 	if (!devm_request_mem_region(cmn->dev, base, size, dev_name(cmn->dev)))
 		return dev_err_probe(cmn->dev, -EBUSY,
-				     "Failed to request DTC region 0x%llx\n", base);
+				     "Failed to request DTC region 0x%pa\n", &base);
 
 	writel_relaxed(CMN_DT_DTC_CTL_DT_EN, dtc->base + CMN_DT_DTC_CTL);
 	writel_relaxed(CMN_DT_PMCR_PMU_EN | CMN_DT_PMCR_OVFL_INTR_EN, CMN_DT_PMCR(dtc));

---
base-commit: 2f89b7f78c50ca973ca035ceb30426f78d9e0996
change-id: 20260325-perf-arm-cmn-fix-resource_size_t-format-b01795e36e60

Best regards,
--  
Nathan Chancellor <nathan@kernel.org>
Re: [PATCH] perf/arm-cmn: Fix resource_size_t printk specifier in arm_cmn_init_dtc()
Posted by Will Deacon 1 week ago
On Wed, 25 Mar 2026 19:19:26 -0700, Nathan Chancellor wrote:
> When building for 32-bit ARM, there is a warning when using the %llx
> specifier to print a resource_size_t variable:
> 
>   drivers/perf/arm-cmn.c: In function 'arm_cmn_init_dtc':
>   drivers/perf/arm-cmn.c:2149:73: error: format '%llx' expects argument of type 'long long unsigned int', but argument 4 has type 'resource_size_t' {aka 'unsigned int'} [-Werror=format=]
>    2149 |                                      "Failed to request DTC region 0x%llx\n", base);
>         |                                                                      ~~~^     ~~~~
>         |                                                                         |     |
>         |                                                                         |     resource_size_t {aka unsigned int}
>         |                                                                         long long unsigned int
>         |                                                                      %x
> 
> [...]

Applied to will (for-next/perf), thanks!

[1/1] perf/arm-cmn: Fix resource_size_t printk specifier in arm_cmn_init_dtc()
      https://git.kernel.org/will/c/47f06ebbe8da

Cheers,
-- 
Will

https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev
Re: [PATCH] perf/arm-cmn: Fix resource_size_t printk specifier in arm_cmn_init_dtc()
Posted by Robin Murphy 1 week ago
On 2026-03-26 2:19 am, Nathan Chancellor wrote:
> When building for 32-bit ARM, there is a warning when using the %llx
> specifier to print a resource_size_t variable:
> 
>    drivers/perf/arm-cmn.c: In function 'arm_cmn_init_dtc':
>    drivers/perf/arm-cmn.c:2149:73: error: format '%llx' expects argument of type 'long long unsigned int', but argument 4 has type 'resource_size_t' {aka 'unsigned int'} [-Werror=format=]
>     2149 |                                      "Failed to request DTC region 0x%llx\n", base);
>          |                                                                      ~~~^     ~~~~
>          |                                                                         |     |
>          |                                                                         |     resource_size_t {aka unsigned int}
>          |                                                                         long long unsigned int
>          |                                                                      %x
> 
> Use the %pa specifier to handle the possible sizes of phys_addr_t
> properly. This requires passing the variable by reference.

Cheers Nathan! I had seen the kbuild robot reports last night, and was 
going to get to this today, but I'm more than happy to be beaten to it!

Reviewed-by: Robin murphy <robin.murphy@arm.com>

> Fixes: 5394396ff548 ("perf/arm-cmn: Stop claiming entire iomem region")
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---
>   drivers/perf/arm-cmn.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/perf/arm-cmn.c b/drivers/perf/arm-cmn.c
> index 1ac91cda6780..5c727c2abaf0 100644
> --- a/drivers/perf/arm-cmn.c
> +++ b/drivers/perf/arm-cmn.c
> @@ -2146,7 +2146,7 @@ static int arm_cmn_init_dtc(struct arm_cmn *cmn, struct arm_cmn_node *dn, int id
>   	size = cmn->part == PART_CMN600 ? SZ_16K : SZ_64K;
>   	if (!devm_request_mem_region(cmn->dev, base, size, dev_name(cmn->dev)))
>   		return dev_err_probe(cmn->dev, -EBUSY,
> -				     "Failed to request DTC region 0x%llx\n", base);
> +				     "Failed to request DTC region 0x%pa\n", &base);
>   
>   	writel_relaxed(CMN_DT_DTC_CTL_DT_EN, dtc->base + CMN_DT_DTC_CTL);
>   	writel_relaxed(CMN_DT_PMCR_PMU_EN | CMN_DT_PMCR_OVFL_INTR_EN, CMN_DT_PMCR(dtc));
> 
> ---
> base-commit: 2f89b7f78c50ca973ca035ceb30426f78d9e0996
> change-id: 20260325-perf-arm-cmn-fix-resource_size_t-format-b01795e36e60
> 
> Best regards,
> --
> Nathan Chancellor <nathan@kernel.org>
>