[MLX4] Soft Reset: (bugfix in error flow) handling a case when MLX4_BUS fails during...
[mirror/winof/.git] / hw / mlx4 / kernel / bus / drv / pdo.c
index 826f834..a14f042 100644 (file)
@@ -30,11 +30,19 @@ EvtDeviceProcessQueryInterfaceRequest(
        UNUSED_PARAM(InterfaceType);\r
        UNUSED_PARAM(ExposedInterfaceSpecificData);\r
 \r
-       p_ib_ifc->p_ibdev = p_fdo->bus_ib_ifc.p_ibdev;\r
-       p_ib_ifc->pmlx4_dev = p_fdo->bus_ib_ifc.pmlx4_dev;\r
-       p_ib_ifc->is_livefish = p_fdo->bus_ib_ifc.is_livefish;\r
+       if (p_fdo->pci_dev.dev) {\r
+               p_ib_ifc->p_ibdev = p_fdo->bus_ib_ifc.p_ibdev;\r
+               p_ib_ifc->pmlx4_dev = p_fdo->bus_ib_ifc.pmlx4_dev;\r
+               p_ib_ifc->is_livefish = p_fdo->bus_ib_ifc.is_livefish;\r
+               return STATUS_SUCCESS;\r
+       }\r
+       else {\r
+               p_ib_ifc->p_ibdev = NULL;\r
+               p_ib_ifc->pmlx4_dev = NULL;\r
+               p_ib_ifc->is_livefish = FALSE;\r
+               return STATUS_UNSUCCESSFUL;\r
+       }\r
 \r
-       return STATUS_SUCCESS;\r
 }\r
 \r
 NTSTATUS\r
@@ -182,7 +190,7 @@ Return Value:
        p_pdo->PdoDevice = hChild;\r
 \r
        //\r
-       // Set some properties for the child device.\r
+       // Set PnP properties for the child device.\r
        //\r
        WDF_DEVICE_PNP_CAPABILITIES_INIT(&pnpCaps);\r
        pnpCaps.Removable         = WdfTrue;\r
@@ -194,6 +202,9 @@ Return Value:
 \r
        WdfDeviceSetPnpCapabilities(hChild, &pnpCaps);\r
 \r
+       //\r
+       // Set Power properties for the child device\r
+       //\r
        WDF_DEVICE_POWER_CAPABILITIES_INIT(&powerCaps);\r
 \r
        powerCaps.DeviceD1 = WdfTrue;\r
@@ -209,6 +220,9 @@ Return Value:
 \r
        WdfDeviceSetPowerCapabilities(hChild, &powerCaps);\r
 \r
+       //\r
+       // Set bus IB interface\r
+       //\r
        p_fdo->bus_ib_ifc.port_id = (u8) SerialNo;\r
        p_fdo->bus_ib_ifc.pVipBusIfc = &p_fdo->mtnic_Ifc;\r
        p_fdo->bus_ib_ifc.mlx4_interface.mlx4_pd_alloc = mlx4_pd_alloc;\r