summaryrefslogtreecommitdiffstats
path: root/virt/kvm
diff options
context:
space:
mode:
authorGeliang Tang <geliangtang@163.com>2016-01-01 19:47:12 +0800
committerPaolo Bonzini <pbonzini@redhat.com>2016-02-23 15:40:53 +0100
commite6e3b5a64e5f15ebd569118a9af16bd4165cbd1a (patch)
tree92c794d5d8f148b531b8e40f9cc5cbfa7cfc52a3 /virt/kvm
parente9ee956e311d3d0a1506995b98e8de0b30773e1a (diff)
downloadop-kernel-dev-e6e3b5a64e5f15ebd569118a9af16bd4165cbd1a.zip
op-kernel-dev-e6e3b5a64e5f15ebd569118a9af16bd4165cbd1a.tar.gz
KVM: use list_for_each_entry_safe
Use list_for_each_entry_safe() instead of list_for_each_safe() to simplify the code. Signed-off-by: Geliang Tang <geliangtang@163.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'virt/kvm')
-rw-r--r--virt/kvm/kvm_main.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index ba45e41..39c36d4 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -620,13 +620,10 @@ void *kvm_kvzalloc(unsigned long size)
static void kvm_destroy_devices(struct kvm *kvm)
{
- struct list_head *node, *tmp;
+ struct kvm_device *dev, *tmp;
- list_for_each_safe(node, tmp, &kvm->devices) {
- struct kvm_device *dev =
- list_entry(node, struct kvm_device, vm_node);
-
- list_del(node);
+ list_for_each_entry_safe(dev, tmp, &kvm->devices, vm_node) {
+ list_del(&dev->vm_node);
dev->ops->destroy(dev);
}
}
OpenPOWER on IntegriCloud