Skip to contentSkip to conversation

KVM: arm64: vgic: simplify vgic_v3_redist_region_full()

PATCH In review Osama Abdelkader 2 participants 2 messages Dec 11, 2025 – Dec 12, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 KVM: arm64: vgic: simplify vgic_v3_redist_region_full()

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

---
 arch/arm64/kvm/vgic/vgic.h | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
arch/arm64/kvm/vgic/vgic.h +1 -4
index 5f0fc96b4dc2..04dd2055e7df 100644
@@ -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);
Signature · 1 line
2.43.0
maintainer
#1 lore raw
Quoted 16 lines · Osama Abdelkader

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

---
 arch/arm64/kvm/vgic/vgic.h | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
arch/arm64/kvm/vgic/vgic.h +0 -0
index 5f0fc96b4dc2..04dd2055e7df 100644
@@ -382,10 +382,7 @@ static inline int vgic_v3_max_apr_idx(struct kvm_vcpu *vcpu)
 static inline bool

arch/arm64/kvm/vgic/vgic.h static inline int vgic_v3_max_apr_idx(struct kvm_vcpu *vcpu) · line 388

Quoted 10 lines
arch/arm64/kvm/vgic/vgic.h +1 -4
 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.
Signature · 1 line
Without deviation from the norm, progress is not possible.