aboutsummaryrefslogtreecommitdiffstats
path: root/virt/kvm/kvm_main.c
diff options
context:
space:
mode:
authorXiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>2012-08-03 03:42:10 -0400
committerAvi Kivity <avi@redhat.com>2012-08-06 09:04:57 -0400
commitcb9aaa30b133574b646d9d4766ef08a843211393 (patch)
tree214d3b1dd115573d1aea11d2f4dafe525a1ac674 /virt/kvm/kvm_main.c
parent6cede2e6794be6b0649f62d3681e0c4aff5a9270 (diff)
KVM: do not release the error pfn
After commit a2766325cf9f9, the error pfn is replaced by the error code, it need not be released anymore [ The patch has been compiling tested for powerpc ] Signed-off-by: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'virt/kvm/kvm_main.c')
-rw-r--r--virt/kvm/kvm_main.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 93d3c6e063c8..eafba99d1070 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -102,9 +102,6 @@ static bool largepages_enabled = true;
102 102
103bool kvm_is_mmio_pfn(pfn_t pfn) 103bool kvm_is_mmio_pfn(pfn_t pfn)
104{ 104{
105 if (is_error_pfn(pfn))
106 return false;
107
108 if (pfn_valid(pfn)) { 105 if (pfn_valid(pfn)) {
109 int reserved; 106 int reserved;
110 struct page *tail = pfn_to_page(pfn); 107 struct page *tail = pfn_to_page(pfn);
@@ -1165,10 +1162,13 @@ EXPORT_SYMBOL_GPL(gfn_to_page_many_atomic);
1165 1162
1166static struct page *kvm_pfn_to_page(pfn_t pfn) 1163static struct page *kvm_pfn_to_page(pfn_t pfn)
1167{ 1164{
1168 WARN_ON(kvm_is_mmio_pfn(pfn)); 1165 if (is_error_pfn(pfn))
1166 return KVM_ERR_PTR_BAD_PAGE;
1169 1167
1170 if (is_error_pfn(pfn) || kvm_is_mmio_pfn(pfn)) 1168 if (kvm_is_mmio_pfn(pfn)) {
1169 WARN_ON(1);
1171 return KVM_ERR_PTR_BAD_PAGE; 1170 return KVM_ERR_PTR_BAD_PAGE;
1171 }
1172 1172
1173 return pfn_to_page(pfn); 1173 return pfn_to_page(pfn);
1174} 1174}
@@ -1193,7 +1193,9 @@ EXPORT_SYMBOL_GPL(kvm_release_page_clean);
1193 1193
1194void kvm_release_pfn_clean(pfn_t pfn) 1194void kvm_release_pfn_clean(pfn_t pfn)
1195{ 1195{
1196 if (!is_error_pfn(pfn) && !kvm_is_mmio_pfn(pfn)) 1196 WARN_ON(is_error_pfn(pfn));
1197
1198 if (!kvm_is_mmio_pfn(pfn))
1197 put_page(pfn_to_page(pfn)); 1199 put_page(pfn_to_page(pfn));
1198} 1200}
1199EXPORT_SYMBOL_GPL(kvm_release_pfn_clean); 1201EXPORT_SYMBOL_GPL(kvm_release_pfn_clean);