cxl/hdm: Clean up a debug printk

Message ID 3d3d969d-651d-4e9d-a892-900876a60ab5@moroto.mountain
State New
Headers
Series cxl/hdm: Clean up a debug printk |

Commit Message

Dan Carpenter Feb. 22, 2024, 6:14 a.m. UTC
  Smatch complains that %pa is for phys_addr_t types and "size" is a u64.

    drivers/cxl/core/hdm.c:521 cxl_dpa_alloc() error: '%pa' expects
    argument of type 'phys_addr_t*', argument 4 has type 'ullong*

Looking at this, to me it seems more useful to print the sizes as
decimal instead of hex.  Let's do that.

Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 drivers/cxl/core/hdm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Comments

Dave Jiang Feb. 22, 2024, 6:29 p.m. UTC | #1
On 2/21/24 11:14 PM, Dan Carpenter wrote:
> Smatch complains that %pa is for phys_addr_t types and "size" is a u64.
> 
>     drivers/cxl/core/hdm.c:521 cxl_dpa_alloc() error: '%pa' expects
>     argument of type 'phys_addr_t*', argument 4 has type 'ullong*
> 
> Looking at this, to me it seems more useful to print the sizes as
> decimal instead of hex.  Let's do that.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>

Reviewed-by: Dave Jiang <dave.jiang@intel.com>
> ---
>  drivers/cxl/core/hdm.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/cxl/core/hdm.c b/drivers/cxl/core/hdm.c
> index 7d97790b893d..0b1843631b26 100644
> --- a/drivers/cxl/core/hdm.c
> +++ b/drivers/cxl/core/hdm.c
> @@ -518,9 +518,9 @@ int cxl_dpa_alloc(struct cxl_endpoint_decoder *cxled, unsigned long long size)
>  	}
>  
>  	if (size > avail) {
> -		dev_dbg(dev, "%pa exceeds available %s capacity: %pa\n", &size,
> +		dev_dbg(dev, "%llu exceeds available %s capacity: %llu\n", size,
>  			cxled->mode == CXL_DECODER_RAM ? "ram" : "pmem",
> -			&avail);
> +			(u64)avail);
>  		rc = -ENOSPC;
>  		goto out;
>  	}
  
fan Feb. 22, 2024, 6:51 p.m. UTC | #2
On Thu, Feb 22, 2024 at 09:14:02AM +0300, Dan Carpenter wrote:
> Smatch complains that %pa is for phys_addr_t types and "size" is a u64.
> 
>     drivers/cxl/core/hdm.c:521 cxl_dpa_alloc() error: '%pa' expects
>     argument of type 'phys_addr_t*', argument 4 has type 'ullong*
> 
> Looking at this, to me it seems more useful to print the sizes as
> decimal instead of hex.  Let's do that.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---

Reviewed-by: Fan Ni <fan.ni@samsung.com>

>  drivers/cxl/core/hdm.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/cxl/core/hdm.c b/drivers/cxl/core/hdm.c
> index 7d97790b893d..0b1843631b26 100644
> --- a/drivers/cxl/core/hdm.c
> +++ b/drivers/cxl/core/hdm.c
> @@ -518,9 +518,9 @@ int cxl_dpa_alloc(struct cxl_endpoint_decoder *cxled, unsigned long long size)
>  	}
>  
>  	if (size > avail) {
> -		dev_dbg(dev, "%pa exceeds available %s capacity: %pa\n", &size,
> +		dev_dbg(dev, "%llu exceeds available %s capacity: %llu\n", size,
>  			cxled->mode == CXL_DECODER_RAM ? "ram" : "pmem",
> -			&avail);
> +			(u64)avail);
>  		rc = -ENOSPC;
>  		goto out;
>  	}
> -- 
> 2.43.0
>
  

Patch

diff --git a/drivers/cxl/core/hdm.c b/drivers/cxl/core/hdm.c
index 7d97790b893d..0b1843631b26 100644
--- a/drivers/cxl/core/hdm.c
+++ b/drivers/cxl/core/hdm.c
@@ -518,9 +518,9 @@  int cxl_dpa_alloc(struct cxl_endpoint_decoder *cxled, unsigned long long size)
 	}
 
 	if (size > avail) {
-		dev_dbg(dev, "%pa exceeds available %s capacity: %pa\n", &size,
+		dev_dbg(dev, "%llu exceeds available %s capacity: %llu\n", size,
 			cxled->mode == CXL_DECODER_RAM ? "ram" : "pmem",
-			&avail);
+			(u64)avail);
 		rc = -ENOSPC;
 		goto out;
 	}