On 2017/9/14 3:14, Christoffer Dall wrote: > On Wed, Sep 06, 2017 at 09:05:08PM +0800, wanghaibin wrote: >> We slightly refactor vgic_its_destroy, separate vgic_its_free_list() >> function for later patch invoke. >> >> The patch also take a functional change. If the its->device_list.next > > I don't see a functional change in this patch? I mean, if this check can its->device_list.next happened, this patch will free the its structure compared with the original implementation. Thanks > > Thanks, > -Christoffer > >> is NULL, we still should free the its. >> Honestly, I can't understand How does the its->device_list.next is NULL >> happened at this moment. >> >> Signed-off-by: wanghaibin <wanghaibin.wang@xxxxxxxxxx> >> --- >> virt/kvm/arm/vgic/vgic-its.c | 11 ++++++++--- >> 1 file changed, 8 insertions(+), 3 deletions(-) >> >> diff --git a/virt/kvm/arm/vgic/vgic-its.c b/virt/kvm/arm/vgic/vgic-its.c >> index aa6b68d..25d614f 100644 >> --- a/virt/kvm/arm/vgic/vgic-its.c >> +++ b/virt/kvm/arm/vgic/vgic-its.c >> @@ -1624,10 +1624,8 @@ static void vgic_its_free_device(struct kvm *kvm, struct its_device *dev) >> kfree(dev); >> } >> >> -static void vgic_its_destroy(struct kvm_device *kvm_dev) >> +static void vgic_its_free_list(struct kvm *kvm, struct vgic_its *its) >> { >> - struct kvm *kvm = kvm_dev->kvm; >> - struct vgic_its *its = kvm_dev->private; >> struct list_head *cur, *temp; >> >> /* >> @@ -1653,7 +1651,14 @@ static void vgic_its_destroy(struct kvm_device *kvm_dev) >> kfree(coll); >> } >> mutex_unlock(&its->its_lock); >> +} >> + >> +static void vgic_its_destroy(struct kvm_device *kvm_dev) >> +{ >> + struct kvm *kvm = kvm_dev->kvm; >> + struct vgic_its *its = kvm_dev->private; >> >> + vgic_its_free_list(kvm, its); >> kfree(its); >> } >> >> -- >> 1.8.3.1 >> >> > > . > _______________________________________________ kvmarm mailing list kvmarm@xxxxxxxxxxxxxxxxxxxxx https://lists.cs.columbia.edu/mailman/listinfo/kvmarm