[PATCH] lib/test_hmm: drop redundant conversion to bool

Xichao Zhao posted 1 patch 1 month, 2 weeks ago
lib/test_hmm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] lib/test_hmm: drop redundant conversion to bool
Posted by Xichao Zhao 1 month, 2 weeks ago
The result of integer comparison already evaluates to bool. No need for
explicit conversion.

No functional impact.

Signed-off-by: Xichao Zhao <zhao.xichao@vivo.com>
---
 lib/test_hmm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/test_hmm.c b/lib/test_hmm.c
index 761725bc713c..83e3d8208a54 100644
--- a/lib/test_hmm.c
+++ b/lib/test_hmm.c
@@ -140,7 +140,7 @@ static int dmirror_bounce_init(struct dmirror_bounce *bounce,
 static bool dmirror_is_private_zone(struct dmirror_device *mdevice)
 {
 	return (mdevice->zone_device_type ==
-		HMM_DMIRROR_MEMORY_DEVICE_PRIVATE) ? true : false;
+		HMM_DMIRROR_MEMORY_DEVICE_PRIVATE);
 }
 
 static enum migrate_vma_direction
-- 
2.34.1
Re: [PATCH] lib/test_hmm: drop redundant conversion to bool
Posted by Alistair Popple 1 month, 1 week ago
On 2025-08-19 at 17:04 +1000, Xichao Zhao <zhao.xichao@vivo.com> wrote...
> The result of integer comparison already evaluates to bool. No need for
> explicit conversion.

Seems reasonable.

Reviewed-by: Alistair Popple <apopple@nvidia.com>

> No functional impact.
> 
> Signed-off-by: Xichao Zhao <zhao.xichao@vivo.com>
> ---
>  lib/test_hmm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/test_hmm.c b/lib/test_hmm.c
> index 761725bc713c..83e3d8208a54 100644
> --- a/lib/test_hmm.c
> +++ b/lib/test_hmm.c
> @@ -140,7 +140,7 @@ static int dmirror_bounce_init(struct dmirror_bounce *bounce,
>  static bool dmirror_is_private_zone(struct dmirror_device *mdevice)
>  {
>  	return (mdevice->zone_device_type ==
> -		HMM_DMIRROR_MEMORY_DEVICE_PRIVATE) ? true : false;
> +		HMM_DMIRROR_MEMORY_DEVICE_PRIVATE);
>  }
>  
>  static enum migrate_vma_direction
> -- 
> 2.34.1
> 
>