* [PATCH] KVM: remove redundant NULL tests
@ 2010-01-14 17:05 Roel Kluin
2010-01-16 18:29 ` Bill Davidsen
2010-01-17 12:26 ` Avi Kivity
0 siblings, 2 replies; 4+ messages in thread
From: Roel Kluin @ 2010-01-14 17:05 UTC (permalink / raw)
To: Xiantao Zhang, kvm-ia64, Andrew Morton, LKML; +Cc: Avi Kivity, kvm
kvm_get_exit_data() cannot return a NULL pointer.
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
arch/ia64/kvm/kvm_fw.c | 28 +++++++++++++---------------
1 files changed, 13 insertions(+), 15 deletions(-)
diff --git a/arch/ia64/kvm/kvm_fw.c b/arch/ia64/kvm/kvm_fw.c
index e4b8231..cb548ee 100644
--- a/arch/ia64/kvm/kvm_fw.c
+++ b/arch/ia64/kvm/kvm_fw.c
@@ -75,7 +75,7 @@ static void set_pal_result(struct kvm_vcpu *vcpu,
struct exit_ctl_data *p;
p = kvm_get_exit_data(vcpu);
- if (p && p->exit_reason == EXIT_REASON_PAL_CALL) {
+ if (p->exit_reason == EXIT_REASON_PAL_CALL) {
p->u.pal_data.ret = result;
return ;
}
@@ -87,7 +87,7 @@ static void set_sal_result(struct kvm_vcpu *vcpu,
struct exit_ctl_data *p;
p = kvm_get_exit_data(vcpu);
- if (p && p->exit_reason == EXIT_REASON_SAL_CALL) {
+ if (p->exit_reason == EXIT_REASON_SAL_CALL) {
p->u.sal_data.ret = result;
return ;
}
@@ -322,7 +322,7 @@ static u64 kvm_get_pal_call_index(struct kvm_vcpu *vcpu)
struct exit_ctl_data *p;
p = kvm_get_exit_data(vcpu);
- if (p && (p->exit_reason == EXIT_REASON_PAL_CALL))
+ if (p->exit_reason == EXIT_REASON_PAL_CALL)
index = p->u.pal_data.gr28;
return index;
@@ -646,18 +646,16 @@ static void kvm_get_sal_call_data(struct kvm_vcpu *vcpu, u64 *in0, u64 *in1,
p = kvm_get_exit_data(vcpu);
- if (p) {
- if (p->exit_reason == EXIT_REASON_SAL_CALL) {
- *in0 = p->u.sal_data.in0;
- *in1 = p->u.sal_data.in1;
- *in2 = p->u.sal_data.in2;
- *in3 = p->u.sal_data.in3;
- *in4 = p->u.sal_data.in4;
- *in5 = p->u.sal_data.in5;
- *in6 = p->u.sal_data.in6;
- *in7 = p->u.sal_data.in7;
- return ;
- }
+ if (p->exit_reason == EXIT_REASON_SAL_CALL) {
+ *in0 = p->u.sal_data.in0;
+ *in1 = p->u.sal_data.in1;
+ *in2 = p->u.sal_data.in2;
+ *in3 = p->u.sal_data.in3;
+ *in4 = p->u.sal_data.in4;
+ *in5 = p->u.sal_data.in5;
+ *in6 = p->u.sal_data.in6;
+ *in7 = p->u.sal_data.in7;
+ return ;
}
*in0 = 0;
}
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] KVM: remove redundant NULL tests
2010-01-14 17:05 [PATCH] KVM: remove redundant NULL tests Roel Kluin
@ 2010-01-16 18:29 ` Bill Davidsen
2010-01-17 3:19 ` Zhang, Xiantao
2010-01-17 12:26 ` Avi Kivity
1 sibling, 1 reply; 4+ messages in thread
From: Bill Davidsen @ 2010-01-16 18:29 UTC (permalink / raw)
To: Roel Kluin; +Cc: Xiantao Zhang, kvm-ia64, Andrew Morton, LKML, Avi Kivity, kvm
Roel Kluin wrote:
> kvm_get_exit_data() cannot return a NULL pointer.
>
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
> ---
> arch/ia64/kvm/kvm_fw.c | 28 +++++++++++++---------------
> 1 files changed, 13 insertions(+), 15 deletions(-)
>
> diff --git a/arch/ia64/kvm/kvm_fw.c b/arch/ia64/kvm/kvm_fw.c
> index e4b8231..cb548ee 100644
> --- a/arch/ia64/kvm/kvm_fw.c
> +++ b/arch/ia64/kvm/kvm_fw.c
> @@ -75,7 +75,7 @@ static void set_pal_result(struct kvm_vcpu *vcpu,
> struct exit_ctl_data *p;
>
> p = kvm_get_exit_data(vcpu);
> - if (p && p->exit_reason == EXIT_REASON_PAL_CALL) {
> + if (p->exit_reason == EXIT_REASON_PAL_CALL) {
> p->u.pal_data.ret = result;
> return ;
> }
[___etc___]
Clearly the original author thought that there was a path where kvm_exit_data
could return a NULL pointer, was that ever possible?
--
Bill Davidsen <davidsen@tmr.com>
"We have more to fear from the bungling of the incompetent than from
the machinations of the wicked." - from Slashdot
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH] KVM: remove redundant NULL tests
2010-01-16 18:29 ` Bill Davidsen
@ 2010-01-17 3:19 ` Zhang, Xiantao
0 siblings, 0 replies; 4+ messages in thread
From: Zhang, Xiantao @ 2010-01-17 3:19 UTC (permalink / raw)
To: Bill Davidsen, Roel Kluin; +Cc: kvm-ia64, Andrew Morton, LKML, Avi Kivity, kvm
Bill Davidsen wrote:
> Roel Kluin wrote:
>> kvm_get_exit_data() cannot return a NULL pointer.
>>
>> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
>> ---
>> arch/ia64/kvm/kvm_fw.c | 28 +++++++++++++---------------
>> 1 files changed, 13 insertions(+), 15 deletions(-)
>>
>> diff --git a/arch/ia64/kvm/kvm_fw.c b/arch/ia64/kvm/kvm_fw.c
>> index e4b8231..cb548ee 100644
>> --- a/arch/ia64/kvm/kvm_fw.c
>> +++ b/arch/ia64/kvm/kvm_fw.c
>> @@ -75,7 +75,7 @@ static void set_pal_result(struct kvm_vcpu *vcpu,
>> struct exit_ctl_data *p;
>>
>> p = kvm_get_exit_data(vcpu);
>> - if (p && p->exit_reason == EXIT_REASON_PAL_CALL) {
>> + if (p->exit_reason == EXIT_REASON_PAL_CALL) {
>> p->u.pal_data.ret = result;
>> return ;
>> }
> [___etc___]
>
> Clearly the original author thought that there was a path where
> kvm_exit_data could return a NULL pointer, was that ever possible?
Originally, we planed to allocate the exit_data dynamically, but considering some constrains, the exit_data is allocated statically, so the check for NULL is useless now.
Xiantao
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] KVM: remove redundant NULL tests
2010-01-14 17:05 [PATCH] KVM: remove redundant NULL tests Roel Kluin
2010-01-16 18:29 ` Bill Davidsen
@ 2010-01-17 12:26 ` Avi Kivity
1 sibling, 0 replies; 4+ messages in thread
From: Avi Kivity @ 2010-01-17 12:26 UTC (permalink / raw)
To: Roel Kluin; +Cc: Xiantao Zhang, kvm-ia64, Andrew Morton, LKML, kvm
On 01/14/2010 07:05 PM, Roel Kluin wrote:
> kvm_get_exit_data() cannot return a NULL pointer.
>
Applied, thanks.
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-01-17 12:26 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-14 17:05 [PATCH] KVM: remove redundant NULL tests Roel Kluin
2010-01-16 18:29 ` Bill Davidsen
2010-01-17 3:19 ` Zhang, Xiantao
2010-01-17 12:26 ` Avi Kivity
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).