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>
This commit is contained in:
parent
e9ee956e31
commit
e6e3b5a64e
1 changed files with 3 additions and 6 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue