Explorar el Código

qcacmn: Fix static analysis

Fix static analysis issues on spectral modules.

CRs-Fixed: 2196066
Change-Id: I7588a26108ff3c0b01f480007ffe3d3b91c29b8e
Sandeep Puligilla hace 7 años
padre
commit
4d3daf5cf0

+ 18 - 1
spectral/dispatcher/src/wlan_spectral_utils_api.c

@@ -120,6 +120,11 @@ spectral_vdev_get_chan_freq(struct wlan_objmgr_vdev *vdev)
 	struct spectral_context *sc;
 
 	sc = spectral_get_spectral_ctx_from_vdev(vdev);
+	if (!sc) {
+		spectral_err("spectral context is Null");
+		return -EINVAL;
+	}
+
 	return sc->legacy_cbacks.vdev_get_chan_freq(vdev);
 }
 
@@ -129,6 +134,11 @@ spectral_vdev_get_ch_width(struct wlan_objmgr_vdev *vdev)
 	struct spectral_context *sc;
 
 	sc = spectral_get_spectral_ctx_from_vdev(vdev);
+	if (!sc) {
+		spectral_err("spectral context is Null");
+		return CH_WIDTH_INVALID;
+	}
+
 	return sc->legacy_cbacks.vdev_get_ch_width(vdev);
 }
 
@@ -139,6 +149,11 @@ spectral_vdev_get_sec20chan_freq_mhz(struct wlan_objmgr_vdev *vdev,
 	struct spectral_context *sc;
 
 	sc = spectral_get_spectral_ctx_from_vdev(vdev);
+	if (!sc) {
+		spectral_err("spectral context is Null");
+		return -EINVAL;
+	}
+
 	return sc->legacy_cbacks.vdev_get_sec20chan_freq_mhz(vdev,
 							     sec20chan_freq);
 }
@@ -166,8 +181,10 @@ wlan_register_wmi_spectral_cmd_ops(struct wlan_objmgr_pdev *pdev,
 		spectral_err("PDEV is NULL!");
 
 	sc = spectral_get_spectral_ctx_from_pdev(pdev);
-	if (!sc)
+	if (!sc) {
 		spectral_err("spectral context is NULL!");
+		return;
+	}
 
 	return sc->sptrlc_register_wmi_spectral_cmd_ops(pdev, cmd_ops);
 }

+ 1 - 0
target_if/spectral/target_if_spectral.c

@@ -561,6 +561,7 @@ target_if_spectral_info_read(
 	 */
 	init_def_retval = target_if_spectral_info_init_defaults(spectral);
 	if (init_def_retval != QDF_STATUS_SUCCESS) {
+		qdf_spin_unlock(&info->osps_lock);
 		if (init_def_retval == QDF_STATUS_E_NOENT)
 			return -ENOENT;
 		else

+ 12 - 0
target_if/spectral/target_if_spectral.h

@@ -1131,6 +1131,10 @@ int16_t target_if_vdev_get_chan_freq(struct wlan_objmgr_vdev *vdev)
 	struct wlan_objmgr_psoc *psoc = NULL;
 
 	psoc = wlan_vdev_get_psoc(vdev);
+	if (!psoc) {
+		spectral_err("psoc is NULL");
+		return -EINVAL;
+	}
 
 	return psoc->soc_cb.rx_ops.sptrl_rx_ops.sptrlro_vdev_get_chan_freq(
 		vdev);
@@ -1151,6 +1155,10 @@ enum phy_ch_width target_if_vdev_get_ch_width(struct wlan_objmgr_vdev *vdev)
 	struct wlan_objmgr_psoc *psoc = NULL;
 
 	psoc = wlan_vdev_get_psoc(vdev);
+	if (!psoc) {
+		spectral_err("psoc is NULL");
+		return CH_WIDTH_INVALID;
+	}
 
 	return psoc->soc_cb.rx_ops.sptrl_rx_ops.sptrlro_vdev_get_ch_width(
 		vdev);
@@ -1173,6 +1181,10 @@ int target_if_vdev_get_sec20chan_freq_mhz(
 	struct wlan_objmgr_psoc *psoc = NULL;
 
 	psoc = wlan_vdev_get_psoc(vdev);
+	if (!psoc) {
+		spectral_err("psoc is NULL");
+		return -EINVAL;
+	}
 
 	return psoc->soc_cb.rx_ops.sptrl_rx_ops.
 		sptrlro_vdev_get_sec20chan_freq_mhz(vdev, sec20chan_freq);