zram: fix 32-bit atomic_long_t print

Message ID 20230227085629.2362316-1-arnd@kernel.org
State New
Headers
Series zram: fix 32-bit atomic_long_t print |

Commit Message

Arnd Bergmann Feb. 27, 2023, 8:56 a.m. UTC
  From: Arnd Bergmann <arnd@arndb.de>

The type used to print &pool_stats.objs_moved is inconsistent with the
definition:

drivers/block/zram/zram_drv.c: In function 'mm_stat_show':
drivers/block/zram/zram_drv.c:1234:44: error: passing argument 1 of 'atomic64_read' from incompatible pointer type [-Werror=incompatible-pointer-types]

Change the printing code to match.

Fixes: b7d89654a988 ("zram: show zsmalloc objs_moved stat in mm_stat")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/block/zram/zram_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Andrew Morton Feb. 27, 2023, 10:19 p.m. UTC | #1
On Mon, 27 Feb 2023 09:56:21 +0100 Arnd Bergmann <arnd@kernel.org> wrote:

> From: Arnd Bergmann <arnd@arndb.de>
> 
> The type used to print &pool_stats.objs_moved is inconsistent with the
> definition:
> 
> drivers/block/zram/zram_drv.c: In function 'mm_stat_show':
> drivers/block/zram/zram_drv.c:1234:44: error: passing argument 1 of 'atomic64_read' from incompatible pointer type [-Werror=incompatible-pointer-types]
> 
> Change the printing code to match.
> 
> Fixes: b7d89654a988 ("zram: show zsmalloc objs_moved stat in mm_stat")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/block/zram/zram_drv.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
> index 3194e9254c6f..5c4ac0d3e850 100644
> --- a/drivers/block/zram/zram_drv.c
> +++ b/drivers/block/zram/zram_drv.c
> @@ -1231,7 +1231,7 @@ static ssize_t mm_stat_show(struct device *dev,
>  			atomic_long_read(&pool_stats.pages_compacted),
>  			(u64)atomic64_read(&zram->stats.huge_pages),
>  			(u64)atomic64_read(&zram->stats.huge_pages_since),
> -			(u64)atomic64_read(&pool_stats.objs_moved));
> +			(u64)atomic_long_read(&pool_stats.objs_moved));
>  	up_read(&zram->init_lock);
>  
>  	return ret;

Thanks.  I'm using the slightly different fix from Geert:

https://lkml.kernel.org/r/20230225121523.3288544-1-geert+renesas@glider.be
  

Patch

diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index 3194e9254c6f..5c4ac0d3e850 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -1231,7 +1231,7 @@  static ssize_t mm_stat_show(struct device *dev,
 			atomic_long_read(&pool_stats.pages_compacted),
 			(u64)atomic64_read(&zram->stats.huge_pages),
 			(u64)atomic64_read(&zram->stats.huge_pages_since),
-			(u64)atomic64_read(&pool_stats.objs_moved));
+			(u64)atomic_long_read(&pool_stats.objs_moved));
 	up_read(&zram->init_lock);
 
 	return ret;