hc
2023-11-06 e3e12f52b214121840b44c91de5b3e5af5d3eb84
kernel/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_cfgvendor.c
....@@ -6860,11 +6860,13 @@
68606860 cca_congest_ext_channel_req_v2_t *per_chspec_stats = NULL;
68616861 uint per_chspec_stats_size = 0;
68626862 cca_congest_ext_channel_req_v3_t *all_chan_results;
6863
- cca_congest_ext_channel_req_v3_t all_chan_req;
6863
+ cca_congest_ext_channel_req_v3_t *all_chan_req = NULL;
6864
+ uint all_chan_req_size = sizeof(cca_congest_ext_channel_req_v3_t);
68646865 #else
68656866 /* cca_get_stats_ext iovar for Wifi channel statics */
68666867 struct cca_congest_ext_channel_req_v2 *cca_v2_results;
6867
- struct cca_congest_ext_channel_req_v2 cca_v2_req;
6868
+ struct cca_congest_ext_channel_req_v2 *cca_v2_req = NULL;
6869
+ uint cca_v2_req_size = sizeof(cca_congest_ext_channel_req_v2_t);
68686870 #endif /* CHAN_STATS_SUPPORT */
68696871 const wl_cnt_wlc_t *wlc_cnt;
68706872 scb_val_t scbval;
....@@ -7025,10 +7027,16 @@
70257027
70267028 #ifdef CHAN_STATS_SUPPORT
70277029 /* Option to get all channel statistics */
7028
- all_chan_req.num_of_entries = 0;
7029
- all_chan_req.ver = WL_CCA_EXT_REQ_VER_V3;
7030
+ all_chan_req = (void *)MALLOCZ(cfg->osh, all_chan_req_size);
7031
+ if (all_chan_req == NULL) {
7032
+ err = BCME_NOMEM;
7033
+ WL_ERR(("all_chan_req alloc failed\n"));
7034
+ goto exit;
7035
+ }
7036
+ all_chan_req->num_of_entries = 0;
7037
+ all_chan_req->ver = WL_CCA_EXT_REQ_VER_V3;
70307038 err = wldev_iovar_getbuf(bcmcfg_to_prmry_ndev(cfg), "cca_get_stats_ext",
7031
- &all_chan_req, sizeof(all_chan_req), iovar_buf, WLC_IOCTL_MAXLEN, NULL);
7039
+ all_chan_req, all_chan_req_size, iovar_buf, WLC_IOCTL_MAXLEN, NULL);
70327040
70337041 if (err != BCME_OK && err != BCME_UNSUPPORTED) {
70347042 WL_ERR(("cca_get_stats_ext iovar err = %d\n", err));
....@@ -7089,12 +7097,18 @@
70897097 }
70907098 }
70917099 #else
7092
- cca_v2_req.ver = WL_CCA_EXT_REQ_VER_V2;
7093
- cca_v2_req.chanspec =
7100
+ cca_v2_req = (void *)MALLOCZ(cfg->osh, cca_v2_req_size);
7101
+ if (cca_v2_req == NULL) {
7102
+ err = BCME_NOMEM;
7103
+ WL_ERR(("cca_v2_req alloc failed\n"));
7104
+ goto exit;
7105
+ }
7106
+ cca_v2_req->ver = WL_CCA_EXT_REQ_VER_V2;
7107
+ cca_v2_req->chanspec =
70947108 wl_chspec_host_to_driver(wf_chspec_primary20_chspec(cur_chanspec));
70957109
7096
- err = wldev_iovar_getbuf(bcmcfg_to_prmry_ndev(cfg), "cca_get_stats_ext", &cca_v2_req,
7097
- sizeof(cca_v2_req), iovar_buf, WLC_IOCTL_MAXLEN, NULL);
7110
+ err = wldev_iovar_getbuf(bcmcfg_to_prmry_ndev(cfg), "cca_get_stats_ext", cca_v2_req,
7111
+ cca_v2_req_size, iovar_buf, WLC_IOCTL_MAXLEN, NULL);
70987112
70997113 if (err != BCME_OK && err != BCME_UNSUPPORTED) {
71007114 WL_ERR(("cca_get_stats_ext iovar err = %d\n", err));
....@@ -7300,6 +7314,15 @@
73007314 WL_ERR(("Vendor Command reply failed ret:%d \n", err));
73017315
73027316 exit:
7317
+#ifdef CHAN_STATS_SUPPORT
7318
+ if (all_chan_req) {
7319
+ MFREE(cfg->osh, all_chan_req, all_chan_req_size);
7320
+ }
7321
+#else
7322
+ if (cca_v2_req) {
7323
+ MFREE(cfg->osh, cca_v2_req, cca_v2_req_size);
7324
+ }
7325
+#endif /* CHAN_STATS_SUPPORT */
73037326 if (outdata) {
73047327 MFREE(cfg->osh, outdata, WLC_IOCTL_MAXLEN);
73057328 }