Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d32ef547 authored by Dan Carpenter's avatar Dan Carpenter Committed by Paolo Bonzini
Browse files

kvm: x86: hyperv: delete dead code in kvm_hv_hypercall()



"rep_done" is always zero so the "(((u64)rep_done & 0xfff) << 32)"
expression is just zero.  We can remove the "res" temporary variable as
well and just use "ret" directly.

Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent 81811c16
Loading
Loading
Loading
Loading
+7 −8
Original line number Original line Diff line number Diff line
@@ -1307,8 +1307,8 @@ static u16 kvm_hvcall_signal_event(struct kvm_vcpu *vcpu, bool fast, u64 param)


int kvm_hv_hypercall(struct kvm_vcpu *vcpu)
int kvm_hv_hypercall(struct kvm_vcpu *vcpu)
{
{
	u64 param, ingpa, outgpa, ret;
	u64 param, ingpa, outgpa, ret = HV_STATUS_SUCCESS;
	uint16_t code, rep_idx, rep_cnt, res = HV_STATUS_SUCCESS, rep_done = 0;
	uint16_t code, rep_idx, rep_cnt;
	bool fast, longmode;
	bool fast, longmode;


	/*
	/*
@@ -1347,7 +1347,7 @@ int kvm_hv_hypercall(struct kvm_vcpu *vcpu)


	/* Hypercall continuation is not supported yet */
	/* Hypercall continuation is not supported yet */
	if (rep_cnt || rep_idx) {
	if (rep_cnt || rep_idx) {
		res = HV_STATUS_INVALID_HYPERCALL_CODE;
		ret = HV_STATUS_INVALID_HYPERCALL_CODE;
		goto set_result;
		goto set_result;
	}
	}


@@ -1356,14 +1356,14 @@ int kvm_hv_hypercall(struct kvm_vcpu *vcpu)
		kvm_vcpu_on_spin(vcpu, true);
		kvm_vcpu_on_spin(vcpu, true);
		break;
		break;
	case HVCALL_SIGNAL_EVENT:
	case HVCALL_SIGNAL_EVENT:
		res = kvm_hvcall_signal_event(vcpu, fast, ingpa);
		ret = kvm_hvcall_signal_event(vcpu, fast, ingpa);
		if (res != HV_STATUS_INVALID_PORT_ID)
		if (ret != HV_STATUS_INVALID_PORT_ID)
			break;
			break;
		/* maybe userspace knows this conn_id: fall through */
		/* maybe userspace knows this conn_id: fall through */
	case HVCALL_POST_MESSAGE:
	case HVCALL_POST_MESSAGE:
		/* don't bother userspace if it has no way to handle it */
		/* don't bother userspace if it has no way to handle it */
		if (!vcpu_to_synic(vcpu)->active) {
		if (!vcpu_to_synic(vcpu)->active) {
			res = HV_STATUS_INVALID_HYPERCALL_CODE;
			ret = HV_STATUS_INVALID_HYPERCALL_CODE;
			break;
			break;
		}
		}
		vcpu->run->exit_reason = KVM_EXIT_HYPERV;
		vcpu->run->exit_reason = KVM_EXIT_HYPERV;
@@ -1375,12 +1375,11 @@ int kvm_hv_hypercall(struct kvm_vcpu *vcpu)
				kvm_hv_hypercall_complete_userspace;
				kvm_hv_hypercall_complete_userspace;
		return 0;
		return 0;
	default:
	default:
		res = HV_STATUS_INVALID_HYPERCALL_CODE;
		ret = HV_STATUS_INVALID_HYPERCALL_CODE;
		break;
		break;
	}
	}


set_result:
set_result:
	ret = res | (((u64)rep_done & 0xfff) << 32);
	kvm_hv_hypercall_set_result(vcpu, ret);
	kvm_hv_hypercall_set_result(vcpu, ret);
	return 1;
	return 1;
}
}