提交 e6e3b5a6 编写于 作者: G Geliang Tang 提交者: Paolo Bonzini

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: NGeliang Tang <geliangtang@163.com>
Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
上级 e9ee956e
...@@ -620,13 +620,10 @@ void *kvm_kvzalloc(unsigned long size) ...@@ -620,13 +620,10 @@ void *kvm_kvzalloc(unsigned long size)
static void kvm_destroy_devices(struct kvm *kvm) 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) { list_for_each_entry_safe(dev, tmp, &kvm->devices, vm_node) {
struct kvm_device *dev = list_del(&dev->vm_node);
list_entry(node, struct kvm_device, vm_node);
list_del(node);
dev->ops->destroy(dev); dev->ops->destroy(dev);
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册