cnss2: Avoid to call NULL plat_env

For dual chip solution, first chip may fail to probe because of pcie
driver is not ready. During second chip probing, first chip may retry
to probe. So, second chip may set/get plat_env[0], first chip may
set/get plat_env[1].

If sencond chip not attached, plat_env[0] will be cleaned. When
cnss_pci_probe() is called by first chip, cnss_get_plat_priv_by_rc_num()
will call plat_env[0]. However it is already NULL.

Change-Id: Ib959b1a524bf777fc6a826b2771611cb28b8cb99
CRs-Fixed: 3778085
This commit is contained in:
Yu Ouyang
2024-04-03 14:52:25 +08:00
committed by Ravindra Konda
parent 5ca3f8b383
commit e2eff914bc
3 changed files with 46 additions and 18 deletions

View File

@@ -2406,7 +2406,7 @@ static int cnss_pci_config_msi_data(struct cnss_pci_data *pci_priv)
static struct cnss_plat_data *
cnss_get_plat_priv_by_driver_ops(struct cnss_wlan_driver *driver_ops)
{
int plat_env_count = cnss_get_plat_env_count();
int plat_env_count = cnss_get_max_plat_env_count();
struct cnss_plat_data *plat_env;
struct cnss_pci_data *pci_priv;
int i = 0;