[MTHCA] mthca_provider.c - prevent dereference of <NULL> mdev or mdev->ext
authorstansmith <stansmith@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Tue, 17 Mar 2009 16:05:55 +0000 (16:05 +0000)
committerstansmith <stansmith@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Tue, 17 Mar 2009 16:05:55 +0000 (16:05 +0000)
hca_pnp.c - change debug print driver name from MLX4 --> MTHCA, white space alignment.

git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@2033 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

hw/mthca/kernel/hca_pnp.c
hw/mthca/kernel/mthca_provider.c

index 5966b5e..3a9c0dd 100644 (file)
@@ -803,7 +803,7 @@ static void
 __ref_ifc(\r
        IN                              DEVICE_OBJECT*                          p_dev_obj )\r
 {\r
-       hca_dev_ext_t                   *p_ext  = (hca_dev_ext_t*)p_dev_obj->DeviceExtension;\r
+       hca_dev_ext_t   *p_ext  = (hca_dev_ext_t*)p_dev_obj->DeviceExtension;\r
 \r
        HCA_ENTER( HCA_DBG_PNP );\r
 \r
@@ -811,7 +811,7 @@ __ref_ifc(
        ObReferenceObject( p_dev_obj );\r
 \r
        HCA_PRINT( TRACE_LEVEL_ERROR, HCA_DBG_PNP, \r
-               ("MLX4_HCA: CA_guid %I64x, hca_ifc_ref %d\n",\r
+               ("MTHCA: CA_guid %I64x, hca_ifc_ref %d\n",\r
                p_ext->hca.guid, p_ext->n_hca_ifc_ref) );\r
 \r
        HCA_EXIT( HCA_DBG_PNP );\r
@@ -821,7 +821,7 @@ static void
 __deref_ifc(\r
        IN                              DEVICE_OBJECT*                          p_dev_obj )\r
 {\r
-       hca_dev_ext_t                   *p_ext  = (hca_dev_ext_t*)p_dev_obj->DeviceExtension;\r
+       hca_dev_ext_t   *p_ext  = (hca_dev_ext_t*)p_dev_obj->DeviceExtension;\r
 \r
        HCA_ENTER( HCA_DBG_PNP );\r
 \r
@@ -829,7 +829,7 @@ __deref_ifc(
        ObDereferenceObject( p_dev_obj );\r
 \r
        HCA_PRINT( TRACE_LEVEL_ERROR, HCA_DBG_PNP, \r
-               ("MLX4_HCA: CA_guid %I64x, hca_ifc_ref %d\n",\r
+               ("MTHCA: CA_guid %I64x, hca_ifc_ref %d\n",\r
                p_ext->hca.guid, p_ext->n_hca_ifc_ref) );\r
 \r
        HCA_EXIT( HCA_DBG_PNP );\r
index 817ccec..7332bf9 100644 (file)
@@ -71,6 +71,8 @@ int mthca_query_device(struct ib_device *ibdev,
 \r
        if (mthca_is_livefish(mdev)) {\r
                props->max_pd = 1;\r
+               if ( !mdev || !mdev->ext )\r
+                       return err;\r
                props->vendor_id = mdev->ext->hcaConfig.VendorID;\r
                props->vendor_part_id = mdev->ext->hcaConfig.DeviceID;\r
                return 0;\r