port_pnp_ctx_t *p_ctx = p_pnp_rec->pnp_rec.context;\r
\r
BUS_ENTER( BUS_DBG_PNP );\r
- \r
+\r
+ if ( !gp_port_mgr ) {\r
+ // if free_port_mgr has been called , p_bfi->p_port_mgr == NULL \r
+ // this will cause crash on cl_mutex_acquire\r
+ // (leo) i'm not sure when it happens, but i saw it happened\r
+ status = IB_NOT_FOUND;\r
+ goto end;\r
+ }\r
+\r
cl_mutex_acquire( &gp_port_mgr->pdo_mutex );\r
\r
/* Count the number of child devices. */\r
\r
cl_mutex_release( &gp_port_mgr->pdo_mutex );\r
\r
+end:\r
BUS_EXIT( BUS_DBG_PNP );\r
return status;\r
}\r