Skip to content

Commit

Permalink
powerpc kvm: use fdget
Browse files Browse the repository at this point in the history
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
Al Viro committed Sep 4, 2013
1 parent 173c840 commit 70abade
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions arch/powerpc/kvm/powerpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -823,39 +823,39 @@ static int kvm_vcpu_ioctl_enable_cap(struct kvm_vcpu *vcpu,
#endif
#ifdef CONFIG_KVM_MPIC
case KVM_CAP_IRQ_MPIC: {
struct file *filp;
struct fd f;
struct kvm_device *dev;

r = -EBADF;
filp = fget(cap->args[0]);
if (!filp)
f = fdget(cap->args[0]);
if (!f.file)
break;

r = -EPERM;
dev = kvm_device_from_filp(filp);
dev = kvm_device_from_filp(f.file);
if (dev)
r = kvmppc_mpic_connect_vcpu(dev, vcpu, cap->args[1]);

fput(filp);
fdput(f);
break;
}
#endif
#ifdef CONFIG_KVM_XICS
case KVM_CAP_IRQ_XICS: {
struct file *filp;
struct fd f;
struct kvm_device *dev;

r = -EBADF;
filp = fget(cap->args[0]);
if (!filp)
f = fdget(cap->args[0]);
if (!f.file)
break;

r = -EPERM;
dev = kvm_device_from_filp(filp);
dev = kvm_device_from_filp(f.file);
if (dev)
r = kvmppc_xics_connect_vcpu(dev, vcpu, cap->args[1]);

fput(filp);
fdput(f);
break;
}
#endif /* CONFIG_KVM_XICS */
Expand Down

0 comments on commit 70abade

Please sign in to comment.