Fixed bug where IOU objects where quasi-leaked (but still freed on unload
authorftillier <ftillier@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Tue, 19 Jul 2005 00:21:49 +0000 (00:21 +0000)
committerftillier <ftillier@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Tue, 19 Jul 2005 00:21:49 +0000 (00:21 +0000)
of the drivers) if they didn't have any IOCs.

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

core/al/kernel/al_ioc_pnp.c

index a017b65..59b0d57 100644 (file)
@@ -2337,15 +2337,16 @@ __query_ioc_profiles(
 \r
        AL_ENTER( AL_DBG_PNP );\r
 \r
-       for( p_item = cl_fmap_head( &p_results->iou_map );\r
-               p_item != cl_fmap_end( &p_results->iou_map );\r
-               p_item = cl_fmap_next( p_item ) )\r
+       p_item = cl_fmap_head( &p_results->iou_map );\r
+       while( p_item != cl_fmap_end( &p_results->iou_map ) )\r
        {\r
                p_iou = PARENT_STRUCT( p_item, iou_node_t, map_item );\r
                CL_ASSERT( p_iou->info.max_controllers );\r
                CL_ASSERT( cl_fmap_count( &p_iou->path_map ) );\r
                CL_ASSERT( p_iou->p_config_path );\r
+               p_item = cl_fmap_next( p_item );\r
 \r
+               p_mad = NULL;\r
                for( slot = 1; slot <= p_iou->info.max_controllers; slot++ )\r
                {\r
                        if( ioc_at_slot( &p_iou->info, slot ) == IOC_INSTALLED )\r
@@ -2365,6 +2366,12 @@ __query_ioc_profiles(
                                cl_atomic_inc( &p_results->p_svc->query_cnt );\r
                        }\r
                }\r
+               if( !p_mad )\r
+               {\r
+                       /* No IOCs installed in this IOU, or failed to get MAD. */\r
+                       cl_fmap_remove_item( &p_results->iou_map, &p_iou->map_item );\r
+                       __put_iou( gp_ioc_pnp, p_iou );\r
+               }\r
        }\r
 \r
        /* Trap the case where there are no queries to send. */\r