qcacmn: Clean up asserts in Spectral module - Part 1
Clean up null pointer asserts by returning the error status to the caller in the below spectral module files 1.spectral/core/spectral_common.c 2.target_if/spectral/target_if_spectral.h 3.target_if/spectral/target_if_spectral.c Change-Id: Ib8d49c06928379768fb41e34d721bd3840e86330 CRs-Fixed: 3587512
This commit is contained in:

committed by
Rahul Choudhary

parent
8074e983d6
commit
93830f424d
@@ -53,7 +53,10 @@ spectral_get_vdev(struct wlan_objmgr_pdev *pdev, uint8_t vdev_id)
|
|||||||
{
|
{
|
||||||
struct wlan_objmgr_vdev *vdev = NULL;
|
struct wlan_objmgr_vdev *vdev = NULL;
|
||||||
|
|
||||||
qdf_assert_always(pdev);
|
if (!pdev) {
|
||||||
|
spectral_err("pdev is null");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (vdev_id == WLAN_INVALID_VDEV_ID)
|
if (vdev_id == WLAN_INVALID_VDEV_ID)
|
||||||
vdev = wlan_objmgr_pdev_get_first_vdev(pdev, WLAN_SPECTRAL_ID);
|
vdev = wlan_objmgr_pdev_get_first_vdev(pdev, WLAN_SPECTRAL_ID);
|
||||||
|
@@ -430,9 +430,15 @@ target_if_spectral_get_vdev(struct target_if_spectral *spectral,
|
|||||||
struct wlan_objmgr_pdev *pdev = NULL;
|
struct wlan_objmgr_pdev *pdev = NULL;
|
||||||
struct wlan_objmgr_vdev *first_vdev = NULL;
|
struct wlan_objmgr_vdev *first_vdev = NULL;
|
||||||
|
|
||||||
qdf_assert_always(spectral);
|
if (!spectral) {
|
||||||
|
spectral_err("spectral variable in null.");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
pdev = spectral->pdev_obj;
|
pdev = spectral->pdev_obj;
|
||||||
qdf_assert_always(pdev);
|
if (!pdev) {
|
||||||
|
spectral_err("pdev variable in null.");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (smode >= SPECTRAL_SCAN_MODE_MAX) {
|
if (smode >= SPECTRAL_SCAN_MODE_MAX) {
|
||||||
spectral_err("Invalid Spectral mode %u", smode);
|
spectral_err("Invalid Spectral mode %u", smode);
|
||||||
@@ -488,13 +494,14 @@ target_if_send_vdev_spectral_configure_cmd(struct target_if_spectral *spectral,
|
|||||||
struct wlan_objmgr_vdev *vdev = NULL;
|
struct wlan_objmgr_vdev *vdev = NULL;
|
||||||
struct target_if_psoc_spectral *psoc_spectral;
|
struct target_if_psoc_spectral *psoc_spectral;
|
||||||
|
|
||||||
qdf_assert_always(spectral);
|
if (!spectral || !param || !(spectral->pdev_obj)) {
|
||||||
qdf_assert_always(param);
|
spectral_err("null params: spectral %pK, spectral_config %pK, pdev: %pK.",
|
||||||
|
spectral, param, pdev);
|
||||||
|
return qdf_status_to_os_return(QDF_STATUS_E_NULL_VALUE);
|
||||||
|
}
|
||||||
|
|
||||||
pdev = spectral->pdev_obj;
|
pdev = spectral->pdev_obj;
|
||||||
|
|
||||||
qdf_assert_always(pdev);
|
|
||||||
|
|
||||||
psoc = wlan_pdev_get_psoc(pdev);
|
psoc = wlan_pdev_get_psoc(pdev);
|
||||||
if (!psoc) {
|
if (!psoc) {
|
||||||
spectral_err("psoc is null");
|
spectral_err("psoc is null");
|
||||||
@@ -571,11 +578,17 @@ target_if_send_vdev_spectral_enable_cmd(struct target_if_spectral *spectral,
|
|||||||
struct wlan_objmgr_vdev *vdev = NULL;
|
struct wlan_objmgr_vdev *vdev = NULL;
|
||||||
struct target_if_psoc_spectral *psoc_spectral;
|
struct target_if_psoc_spectral *psoc_spectral;
|
||||||
|
|
||||||
qdf_assert_always(spectral);
|
if (!spectral) {
|
||||||
|
spectral_err("spectral is null");
|
||||||
|
return qdf_status_to_os_return(QDF_STATUS_E_NULL_VALUE);
|
||||||
|
}
|
||||||
|
|
||||||
pdev = spectral->pdev_obj;
|
pdev = spectral->pdev_obj;
|
||||||
|
|
||||||
qdf_assert_always(pdev);
|
if (!pdev) {
|
||||||
|
spectral_err("pdev is null");
|
||||||
|
return qdf_status_to_os_return(QDF_STATUS_E_NULL_VALUE);
|
||||||
|
}
|
||||||
|
|
||||||
psoc = wlan_pdev_get_psoc(pdev);
|
psoc = wlan_pdev_get_psoc(pdev);
|
||||||
if (!psoc) {
|
if (!psoc) {
|
||||||
@@ -1803,7 +1816,11 @@ target_if_spectral_get_extension_channel(void *arg,
|
|||||||
struct wlan_objmgr_vdev *vdev = NULL;
|
struct wlan_objmgr_vdev *vdev = NULL;
|
||||||
uint16_t sec20chan_freq = 0;
|
uint16_t sec20chan_freq = 0;
|
||||||
|
|
||||||
qdf_assert_always(arg);
|
if (!arg) {
|
||||||
|
spectral_err("Null argument.");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
spectral = (struct target_if_spectral *)arg;
|
spectral = (struct target_if_spectral *)arg;
|
||||||
|
|
||||||
if (smode >= SPECTRAL_SCAN_MODE_MAX) {
|
if (smode >= SPECTRAL_SCAN_MODE_MAX) {
|
||||||
@@ -1846,7 +1863,11 @@ target_if_spectral_get_current_channel(void *arg, enum spectral_scan_mode smode)
|
|||||||
int16_t chan_freq = 0;
|
int16_t chan_freq = 0;
|
||||||
struct wlan_objmgr_vdev *vdev = NULL;
|
struct wlan_objmgr_vdev *vdev = NULL;
|
||||||
|
|
||||||
qdf_assert_always(arg);
|
if (!arg) {
|
||||||
|
spectral_err("Null argument.");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
spectral = (struct target_if_spectral *)arg;
|
spectral = (struct target_if_spectral *)arg;
|
||||||
|
|
||||||
if (smode >= SPECTRAL_SCAN_MODE_MAX) {
|
if (smode >= SPECTRAL_SCAN_MODE_MAX) {
|
||||||
@@ -2251,7 +2272,10 @@ target_if_populate_supported_sscan_bws_be(struct target_if_spectral *spectral)
|
|||||||
struct spectral_supported_bws *supported_bws;
|
struct spectral_supported_bws *supported_bws;
|
||||||
QDF_STATUS status;
|
QDF_STATUS status;
|
||||||
|
|
||||||
qdf_assert_always(spectral);
|
if (!spectral) {
|
||||||
|
spectral_err("spectral variable is null");
|
||||||
|
return QDF_STATUS_E_NULL_VALUE;
|
||||||
|
}
|
||||||
|
|
||||||
/* 20MHz */
|
/* 20MHz */
|
||||||
op_bw = CH_WIDTH_20MHZ;
|
op_bw = CH_WIDTH_20MHZ;
|
||||||
|
@@ -2430,7 +2430,8 @@ clamp_fft_bin_value(uint16_t fft_bin_value, uint16_t pwr_format)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
qdf_assert_always(0);
|
spectral_err_rl("Invalid pwr format: %d.", pwr_format);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return clamped_fft_bin_value;
|
return clamped_fft_bin_value;
|
||||||
|
Reference in New Issue
Block a user