DriverEntry Return Values
The DriverEntry routine should postpone any call to IoRegisterDriverReinitialization until just before it returns STATUS_SUCCESS. It must not make this call unless it will return STATUS_SUCCESS.
If a DriverEntry routine returns an NTSTATUS value that is not a success or informational value, such as STATUS_SUCCESS, the driver for that DriverEntry routine is not loaded.
A DriverEntry routine that will fail initialization must free any system objects, system resources, and registry resources it has already set up before it returns control. It should reset the driver's dispatch entry points in the driver object for IRP_MJ_FLUSH_BUFFERS and IRP_MJ_SHUTDOWN to NULL if the driver supports these requests.
If a driver will fail initialization, the DriverEntry routine also should log an error before returning control. See Logging Errors.