linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] KVM: arm64: vgic: simplify vgic_v3_redist_region_full()
@ 2025-12-11 22:51 Osama Abdelkader
  2025-12-12  9:35 ` Marc Zyngier
  0 siblings, 1 reply; 2+ messages in thread
From: Osama Abdelkader @ 2025-12-11 22:51 UTC (permalink / raw)
  To: Marc Zyngier, Oliver Upton, Joey Gouly, Suzuki K Poulose,
	Zenghui Yu, Catalin Marinas, Will Deacon, Timothy Hayes,
	Sascha Bischoff, Raghavendra Rao Ananta, Osama Abdelkader,
	Jing Zhang, linux-arm-kernel, kvmarm, linux-kernel

Simplify the function by converting the if-return-false pattern to a
direct boolean expression return, making the code more concise and
readable.

Signed-off-by: Osama Abdelkader <osama.abdelkader@gmail.com>
---
 arch/arm64/kvm/vgic/vgic.h | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/arch/arm64/kvm/vgic/vgic.h b/arch/arm64/kvm/vgic/vgic.h
index 5f0fc96b4dc2..04dd2055e7df 100644
--- a/arch/arm64/kvm/vgic/vgic.h
+++ b/arch/arm64/kvm/vgic/vgic.h
@@ -382,10 +382,7 @@ static inline int vgic_v3_max_apr_idx(struct kvm_vcpu *vcpu)
 static inline bool
 vgic_v3_redist_region_full(struct vgic_redist_region *region)
 {
-	if (!region->count)
-		return false;
-
-	return (region->free_index >= region->count);
+	return region->count > 0 && region->free_index >= region->count;
 }
 
 struct vgic_redist_region *vgic_v3_rdist_free_slot(struct list_head *rdregs);
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] KVM: arm64: vgic: simplify vgic_v3_redist_region_full()
  2025-12-11 22:51 [PATCH] KVM: arm64: vgic: simplify vgic_v3_redist_region_full() Osama Abdelkader
@ 2025-12-12  9:35 ` Marc Zyngier
  0 siblings, 0 replies; 2+ messages in thread
From: Marc Zyngier @ 2025-12-12  9:35 UTC (permalink / raw)
  To: Osama Abdelkader
  Cc: Oliver Upton, Joey Gouly, Suzuki K Poulose, Zenghui Yu,
	Catalin Marinas, Will Deacon, Timothy Hayes, Sascha Bischoff,
	Raghavendra Rao Ananta, Jing Zhang, linux-arm-kernel, kvmarm,
	linux-kernel

On Thu, 11 Dec 2025 22:51:09 +0000,
Osama Abdelkader <osama.abdelkader@gmail.com> wrote:
> 
> Simplify the function by converting the if-return-false pattern to a
> direct boolean expression return, making the code more concise and
> readable.
> 
> Signed-off-by: Osama Abdelkader <osama.abdelkader@gmail.com>
> ---
>  arch/arm64/kvm/vgic/vgic.h | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/arch/arm64/kvm/vgic/vgic.h b/arch/arm64/kvm/vgic/vgic.h
> index 5f0fc96b4dc2..04dd2055e7df 100644
> --- a/arch/arm64/kvm/vgic/vgic.h
> +++ b/arch/arm64/kvm/vgic/vgic.h
> @@ -382,10 +382,7 @@ static inline int vgic_v3_max_apr_idx(struct kvm_vcpu *vcpu)
>  static inline bool
>  vgic_v3_redist_region_full(struct vgic_redist_region *region)
>  {
> -	if (!region->count)
> -		return false;
> -
> -	return (region->free_index >= region->count);
> +	return region->count > 0 && region->free_index >= region->count;
>  }
>  
>  struct vgic_redist_region *vgic_v3_rdist_free_slot(struct list_head *rdregs);

This is not clearer. Checking for 0 is pretty important as it outlines
a specific condition, which is why this is written as a separate
statement.

Please stop sending patches that are only aligning things to your
personal taste. There is no shortage of real problems to fix in the
kernel, your time is better spent on that, and mine on reviewing
useful patches.

	M.

-- 
Without deviation from the norm, progress is not possible.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-12-12  9:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-11 22:51 [PATCH] KVM: arm64: vgic: simplify vgic_v3_redist_region_full() Osama Abdelkader
2025-12-12  9:35 ` Marc Zyngier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).