diff --git a/ntoskrnl/io/pnpmgr/plugplay.c b/ntoskrnl/io/pnpmgr/plugplay.c index 46585458b84..461328c8651 100644 --- a/ntoskrnl/io/pnpmgr/plugplay.c +++ b/ntoskrnl/io/pnpmgr/plugplay.c @@ -218,15 +218,14 @@ IopInitializeDevice( /* Leave, if the device already exists */ DeviceObject = IopGetDeviceObjectFromDeviceInstance(&DeviceInstance); - if (DeviceInstance.Buffer != NULL) + if (DeviceObject != NULL) { DPRINT1("Device %wZ already exists!\n", &DeviceInstance); + ObDereferenceObject(DeviceObject); Status = STATUS_SUCCESS; goto done; } - ObDereferenceObject(DeviceObject); - DPRINT("Device %wZ does not exist!\n", &DeviceInstance); /* Create a device node for the device instance */