summaryrefslogtreecommitdiff
path: root/kvm.c
diff options
context:
space:
mode:
authorRobert Mustacchi <rm@joyent.com>2011-06-27 10:41:58 -0700
committerRobert Mustacchi <rm@joyent.com>2011-06-27 10:41:58 -0700
commit76cb3b1b3f06bf3600157009b86fe9780cf190b9 (patch)
tree93d71d5ba3b62a9c4d89a6f74c03e9dcba536ac9 /kvm.c
parentc6d744a002025061a0de806e86cf1dbdfb7e6f01 (diff)
downloadillumos-kvm-76cb3b1b3f06bf3600157009b86fe9780cf190b9.tar.gz
HVM-419 Always get ENXIO in kvm_open
Diffstat (limited to 'kvm.c')
-rw-r--r--kvm.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/kvm.c b/kvm.c
index 6a0d412..b85c1d6 100644
--- a/kvm.c
+++ b/kvm.c
@@ -2110,15 +2110,6 @@ kvm_open(dev_t *devp, int flag, int otype, cred_t *credp)
kvm_devstate_t *ksp;
- minor = (minor_t)(uintptr_t)vmem_alloc(kvm_minor,
- 1, VM_BESTFIT | VM_SLEEP);
-
- ksp = ddi_get_soft_state(kvm_state, minor);
- if (!ksp) {
- vmem_free(kvm_minor, (void *)(uintptr_t)minor, 1);
- return (ENXIO);
- }
-
if (flag & FEXCL || flag & FNDELAY)
return (EINVAL);
@@ -2137,12 +2128,17 @@ kvm_open(dev_t *devp, int flag, int otype, cred_t *credp)
if (getminor(*devp) != kvm_base_minor)
return (ENXIO);
+ minor = (minor_t)(uintptr_t)vmem_alloc(kvm_minor,
+ 1, VM_BESTFIT | VM_SLEEP);
+
if (ddi_soft_state_zalloc(kvm_state, minor) != 0) {
vmem_free(kvm_minor, (void *)(uintptr_t)minor, 1);
return (ENXIO);
}
*devp = makedevice(getmajor(*devp), minor);
+ ksp = ddi_get_soft_state(kvm_state, minor);
+ VERIFY(ksp != NULL);
return (0);
}