Skip to contentSkip to conversation

KVM: PPC: Remove superfluous check for non-zero return value

PATCH In review Thomas Huth 2 participants 4 messages Sep 11, 2019 – Sep 19, 2019

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

PATCH 1/1 KVM: PPC: Remove superfluous check for non-zero return value

After the kfree()s haven been removed in the previous commit 9798f4ea71ea ("fix rollback when kvmppc_xive_create fails"), the code can be simplified even more to simply always "return ret" now.

---
 arch/powerpc/kvm/book3s_xive.c        | 5 +----
 arch/powerpc/kvm/book3s_xive_native.c | 5 +----
 2 files changed, 2 insertions(+), 8 deletions(-)
arch/powerpc/kvm/book3s_xive.c +1 -4
index e3ba67095895..2f6f463fcdfb 100644
@@ -1986,10 +1986,7 @@ static int kvmppc_xive_create(struct kvm_device *dev, u32 type)
 
 	xive->single_escalation = xive_native_has_single_escalation();
 
-	if (ret)
-		return ret;
-
-	return 0;
+	return ret;
 }
 
 int kvmppc_xive_debug_show_queues(struct seq_file *m, struct kvm_vcpu *vcpu)
arch/powerpc/kvm/book3s_xive_native.c +1 -4
index a998823f68a3..7a50772f26fe 100644
@@ -1089,10 +1089,7 @@ static int kvmppc_xive_native_create(struct kvm_device *dev, u32 type)
 	xive->single_escalation = xive_native_has_single_escalation();
 	xive->ops = &kvmppc_xive_native_ops;
 
-	if (ret)
-		return ret;
-
-	return 0;
+	return ret;
 }
 
 /*
Signature · 1 line
2.18.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · On Wed, 11 Sep 2019 21:52:35 +0200 Thomas Huth <[email protected]> wrote:

After the kfree()s haven been removed in the previous commit 9798f4ea71ea ("fix rollback when kvmppc_xive_create fails"), the code can be simplified even more to simply always "return ret" now.

---

This looks like a good candidate for trivial, hence Cc'ing Jiri and adding trivial keyword in subject.

Quoted 36 lines
 arch/powerpc/kvm/book3s_xive.c        | 5 +----
 arch/powerpc/kvm/book3s_xive_native.c | 5 +----
 2 files changed, 2 insertions(+), 8 deletions(-)
arch/powerpc/kvm/book3s_xive.c +1 -4
index e3ba67095895..2f6f463fcdfb 100644
@@ -1986,10 +1986,7 @@ static int kvmppc_xive_create(struct kvm_device *dev, u32 type)
 
 	xive->single_escalation = xive_native_has_single_escalation();
 
-	if (ret)
-		return ret;
-
-	return 0;
+	return ret;
 }
 
 int kvmppc_xive_debug_show_queues(struct seq_file *m, struct kvm_vcpu *vcpu)
arch/powerpc/kvm/book3s_xive_native.c +1 -4
index a998823f68a3..7a50772f26fe 100644
@@ -1089,10 +1089,7 @@ static int kvmppc_xive_native_create(struct kvm_device *dev, u32 type)
 	xive->single_escalation = xive_native_has_single_escalation();
 	xive->ops = &kvmppc_xive_native_ops;
 
-	if (ret)
-		return ret;
-
-	return 0;
+	return ret;
 }
 
 /*
#2 lore raw
Quoted 8 lines · On Wed, 18 Sep 2019 18:44:36 +0200 Greg Kurz <[email protected]> wrote:
Quoted 5 lines · On Wed, 11 Sep 2019 21:52:35 +0200 Thomas Huth <[email protected]> wrote:

After the kfree()s haven been removed in the previous commit 9798f4ea71ea ("fix rollback when kvmppc_xive_create fails"), the code can be simplified even more to simply always "return ret" now.

Quoted 8 lines
Quoted 2 lines

---

This looks like a good candidate for trivial, hence Cc'ing Jiri and adding trivial keyword in subject.

Oops, the patch is correct but there are some fixes that require the return 0 to stay around...

https://patchwork.ozlabs.org/project/kvm-ppc/list/?series9957

Quoted 37 lines
Quoted 36 lines
 arch/powerpc/kvm/book3s_xive.c        | 5 +----
 arch/powerpc/kvm/book3s_xive_native.c | 5 +----
 2 files changed, 2 insertions(+), 8 deletions(-)
arch/powerpc/kvm/book3s_xive.c +1 -4
index e3ba67095895..2f6f463fcdfb 100644
@@ -1986,10 +1986,7 @@ static int kvmppc_xive_create(struct kvm_device *dev, u32 type)
 
 	xive->single_escalation = xive_native_has_single_escalation();
 
-	if (ret)
-		return ret;
-
-	return 0;
+	return ret;
 }
 
 int kvmppc_xive_debug_show_queues(struct seq_file *m, struct kvm_vcpu *vcpu)
arch/powerpc/kvm/book3s_xive_native.c +1 -4
index a998823f68a3..7a50772f26fe 100644
@@ -1089,10 +1089,7 @@ static int kvmppc_xive_native_create(struct kvm_device *dev, u32 type)
 	xive->single_escalation = xive_native_has_single_escalation();
 	xive->ops = &kvmppc_xive_native_ops;
 
-	if (ret)
-		return ret;
-
-	return 0;
+	return ret;
 }
 
 /*
#3 lore raw
Quoted 17 lines · Greg Kurz
Quoted 14 lines · On Wed, 18 Sep 2019 18:44:36 +0200 Greg Kurz <[email protected]> wrote:
Quoted 7 lines · On Wed, 11 Sep 2019 21:52:35 +0200 Thomas Huth <[email protected]> wrote:

After the kfree()s haven been removed in the previous commit 9798f4ea71ea ("fix rollback when kvmppc_xive_create fails"), the code can be simplified even more to simply always "return ret" now.

---

This looks like a good candidate for trivial, hence Cc'ing Jiri and adding trivial keyword in subject.

Quoted 7 lines
Quoted 2 lines

Oops, the patch is correct but there are some fixes that require the return 0 to stay around...

https://patchwork.ozlabs.org/project/kvm-ppc/list/?series9957

:-)

Ok, then please simply ignore my patch.

Thomas