[ofw] [RFC] [PATCH 4/4] winverbs.sys: partial driver implementation
Fab Tillier
ftillier at windows.microsoft.com
Wed Apr 23 15:24:10 PDT 2008
>>>+NTSTATUS WvPdAlloc(WV_DEVICE *pDevice, WV_PROTECTION_DOMAIN **ppPd,
>>>+ ci_umv_buf_t *pVerbsData)
>>>+{
>>>+ ib_api_status_t ib_status;
>>>+ WV_PROTECTION_DOMAIN *pd;
>>>+
>>>+ pd = ExAllocatePoolWithTag(PagedPool, sizeof(WV_PROTECTION_DOMAIN),
>>'apvw');
>>>+ if (pd == NULL) {
>>>+ return STATUS_NO_MEMORY;
>>>+ }
>>>+
>>>+ pd->Ref = 1;
>>>+ KeInitializeEvent(&pd->Event, NotificationEvent, FALSE);
>>>+ pd->pDevice = pDevice;
>>>+ pd->pVerbs = pDevice->pVerbs;
>>>+ cl_qmap_init(&pd->MrMap);
>>>+ KeInitializeGuardedMutex(&pd->Lock);
>>>+
>>>+ ib_status = pDevice->pVerbs->allocate_pd(pDevice->hVerbsDevice,
>>IB_PDT_NORMAL,
>>>+
>>&pd->hVerbsPd, pVerbsData);
>>>+ if (ib_status != IB_SUCCESS) {
>>>+ goto err;
>>>+ }
>>>+
>>>+ WvDeviceGet(pDevice);
>>
>>I would put this line together with the pDevice assignment so that it's clearer
>>why you're taking a reference.
>
>Then I end up needing to put the reference on failure...
Not if you move the assignment of the pDevice down (and pVerbs too while you're at it).
-Fab
More information about the ofw
mailing list