Kaynağa Gözat

qcacld-3.0: Address return code handling and code cleanup

In Tx power scaling implementation, there are places where return
code is not handled properly and some code formatting needs cleanup.
This change address these issues.

CRs-fixed: 1013097
Change-Id: I3bafde8c046487cc1a80de22348c21f6d835efb5
Peng Xu 9 yıl önce
ebeveyn
işleme
62c8c43b42

+ 13 - 10
core/hdd/src/wlan_hdd_cfg80211.c

@@ -4837,10 +4837,11 @@ static int __wlan_hdd_cfg80211_txpower_scale(struct wiphy *wiphy,
 {
 	hdd_context_t *hdd_ctx = wiphy_priv(wiphy);
 	struct net_device *dev = wdev->netdev;
-	hdd_adapter_t *adapter = NULL;
-	int ret = 0;
+	hdd_adapter_t *adapter;
+	int ret;
 	struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_TXPOWER_SCALE_MAX + 1];
 	uint8_t scale_value;
+	QDF_STATUS status;
 
 	ENTER_DEV(dev);
 
@@ -4869,9 +4870,9 @@ static int __wlan_hdd_cfg80211_txpower_scale(struct wiphy *wiphy,
 		return -EINVAL;
 	}
 
-	ret = wma_set_tx_power_scale(adapter->sessionId, scale_value);
+	status = wma_set_tx_power_scale(adapter->sessionId, scale_value);
 
-	if (ret != 0) {
+	if (QDF_STATUS_SUCCESS != status) {
 		hdd_err("Set tx power scale failed");
 		return -EINVAL;
 	}
@@ -4893,7 +4894,7 @@ static int wlan_hdd_cfg80211_txpower_scale(struct wiphy *wiphy,
 						const void *data,
 						int data_len)
 {
-	int ret = 0;
+	int ret;
 
 	cds_ssr_protect(__func__);
 	ret = __wlan_hdd_cfg80211_txpower_scale(wiphy, wdev,
@@ -4919,10 +4920,11 @@ static int __wlan_hdd_cfg80211_txpower_scale_decr_db(struct wiphy *wiphy,
 {
 	hdd_context_t *hdd_ctx = wiphy_priv(wiphy);
 	struct net_device *dev = wdev->netdev;
-	hdd_adapter_t *adapter = NULL;
-	int ret = 0;
+	hdd_adapter_t *adapter;
+	int ret;
 	struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_TXPOWER_SCALE_DECR_DB_MAX + 1];
 	uint8_t scale_value;
+	QDF_STATUS status;
 
 	ENTER_DEV(dev);
 
@@ -4946,9 +4948,10 @@ static int __wlan_hdd_cfg80211_txpower_scale_decr_db(struct wiphy *wiphy,
 	scale_value = nla_get_u8(tb
 		    [QCA_WLAN_VENDOR_ATTR_TXPOWER_SCALE_DECR_DB]);
 
-	ret = wma_set_tx_power_scale_decr_db(adapter->sessionId, scale_value);
+	status = wma_set_tx_power_scale_decr_db(adapter->sessionId,
+							scale_value);
 
-	if (ret != 0) {
+	if (QDF_STATUS_SUCCESS != status) {
 		hdd_err("Set tx power decrease db failed");
 		return -EINVAL;
 	}
@@ -4970,7 +4973,7 @@ static int wlan_hdd_cfg80211_txpower_scale_decr_db(struct wiphy *wiphy,
 						const void *data,
 						int data_len)
 {
-	int ret = 0;
+	int ret;
 
 	cds_ssr_protect(__func__);
 	ret = __wlan_hdd_cfg80211_txpower_scale_decr_db(wiphy, wdev,

+ 10 - 10
core/hdd/src/wlan_hdd_cfg80211.h

@@ -625,7 +625,7 @@ enum qca_wlan_vendor_attr_get_tdls_capabilities {
 	/* keep last */
 	QCA_WLAN_VENDOR_ATTR_TDLS_GET_CAPS_AFTER_LAST,
 	QCA_WLAN_VENDOR_ATTR_TDLS_GET_CAPS_MAX =
-	QCA_WLAN_VENDOR_ATTR_TDLS_GET_CAPS_AFTER_LAST - 1,
+		QCA_WLAN_VENDOR_ATTR_TDLS_GET_CAPS_AFTER_LAST - 1,
 };
 
 /**
@@ -658,7 +658,7 @@ enum qca_wlan_vendor_attr {
 	QCA_WLAN_VENDOR_ATTR_MAX_CONCURRENT_CHANNELS_5_0_BAND = 11,
 	/* keep last */
 	QCA_WLAN_VENDOR_ATTR_AFTER_LAST,
-	QCA_WLAN_VENDOR_ATTR_MAX = QCA_WLAN_VENDOR_ATTR_AFTER_LAST - 1
+		QCA_WLAN_VENDOR_ATTR_MAX = QCA_WLAN_VENDOR_ATTR_AFTER_LAST - 1
 };
 
 #ifdef FEATURE_WLAN_EXTSCAN
@@ -1161,7 +1161,7 @@ enum qca_wlan_vendor_attr_ll_stats_results_type {
 
 	QCA_WLAN_VENDOR_ATTR_LL_STATS_TYPE_AFTER_LAST,
 	QCA_WLAN_VENDOR_ATTR_LL_STATS_TYPE_MAX =
-	QCA_WLAN_VENDOR_ATTR_LL_STATS_TYPE_AFTER_LAST - 1
+		QCA_WLAN_VENDOR_ATTR_LL_STATS_TYPE_AFTER_LAST - 1
 };
 
 /**
@@ -1545,7 +1545,7 @@ enum qca_wlan_vendor_attr_get_concurrency_matrix {
 	QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_RESULTS_SET = 3,
 	QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_AFTER_LAST,
 	QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_MAX =
-	QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_AFTER_LAST - 1,
+		QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_AFTER_LAST - 1,
 };
 
 /**
@@ -2001,7 +2001,7 @@ enum qca_wlan_vendor_attr_acs_offload {
 	/* keep last */
 	QCA_WLAN_VENDOR_ATTR_ACS_AFTER_LAST,
 	QCA_WLAN_VENDOR_ATTR_ACS_MAX =
-	QCA_WLAN_VENDOR_ATTR_ACS_AFTER_LAST - 1
+		QCA_WLAN_VENDOR_ATTR_ACS_AFTER_LAST - 1
 };
 
 /**
@@ -2251,7 +2251,7 @@ enum qca_vendor_attr_get_preferred_freq_list {
 	/* keep last */
 	QCA_WLAN_VENDOR_ATTR_GET_PREFERRED_FREQ_LIST_AFTER_LAST,
 	QCA_WLAN_VENDOR_ATTR_GET_PREFERRED_FREQ_LIST_MAX =
-	QCA_WLAN_VENDOR_ATTR_GET_PREFERRED_FREQ_LIST_AFTER_LAST - 1
+		QCA_WLAN_VENDOR_ATTR_GET_PREFERRED_FREQ_LIST_AFTER_LAST - 1
 };
 
 /**
@@ -2273,7 +2273,7 @@ enum qca_vendor_attr_probable_oper_channel {
 	/* keep last */
 	QCA_WLAN_VENDOR_ATTR_PROBABLE_OPER_CHANNEL_AFTER_LAST,
 	QCA_WLAN_VENDOR_ATTR_PROBABLE_OPER_CHANNEL_MAX =
-	QCA_WLAN_VENDOR_ATTR_PROBABLE_OPER_CHANNEL_AFTER_LAST - 1
+		QCA_WLAN_VENDOR_ATTR_PROBABLE_OPER_CHANNEL_AFTER_LAST - 1
 };
 
 /**
@@ -2319,7 +2319,7 @@ enum qca_vendor_attr_ota_test {
 	/* keep last */
 	QCA_WLAN_VENDOR_ATTR_OTA_TEST_AFTER_LAST,
 	QCA_WLAN_VENDOR_ATTR_OTA_TEST_MAX =
-	QCA_WLAN_VENDOR_ATTR_OTA_TEST_AFTER_LAST - 1
+		QCA_WLAN_VENDOR_ATTR_OTA_TEST_AFTER_LAST - 1
 };
 
 /** enum qca_vendor_attr_txpower_scale - vendor sub commands index
@@ -2335,7 +2335,7 @@ enum qca_vendor_attr_txpower_scale {
 	/* keep last */
 	QCA_WLAN_VENDOR_ATTR_TXPOWER_SCALE_AFTER_LAST,
 	QCA_WLAN_VENDOR_ATTR_TXPOWER_SCALE_MAX =
-	QCA_WLAN_VENDOR_ATTR_TXPOWER_SCALE_AFTER_LAST - 1
+		QCA_WLAN_VENDOR_ATTR_TXPOWER_SCALE_AFTER_LAST - 1
 };
 
 /**
@@ -2352,7 +2352,7 @@ enum qca_vendor_attr_txpower_scale_decr_db {
 	/* keep last */
 	QCA_WLAN_VENDOR_ATTR_TXPOWER_SCALE_DECR_DB_AFTER_LAST,
 	QCA_WLAN_VENDOR_ATTR_TXPOWER_SCALE_DECR_DB_MAX =
-	QCA_WLAN_VENDOR_ATTR_TXPOWER_SCALE_DECR_DB_AFTER_LAST - 1
+		QCA_WLAN_VENDOR_ATTR_TXPOWER_SCALE_DECR_DB_AFTER_LAST - 1
 };
 
 struct cfg80211_bss *wlan_hdd_cfg80211_update_bss_db(hdd_adapter_t *pAdapter,

+ 2 - 2
core/wma/src/wma_power.c

@@ -2027,7 +2027,7 @@ void wma_set_resume_dtim(tp_wma_handle wma)
  */
 QDF_STATUS wma_set_tx_power_scale(uint8_t vdev_id, int value)
 {
-	QDF_STATUS ret = QDF_STATUS_SUCCESS;
+	QDF_STATUS ret;
 	tp_wma_handle wma_handle =
 			(tp_wma_handle)cds_get_context(QDF_MODULE_ID_WMA);
 
@@ -2058,7 +2058,7 @@ QDF_STATUS wma_set_tx_power_scale(uint8_t vdev_id, int value)
  */
 QDF_STATUS wma_set_tx_power_scale_decr_db(uint8_t vdev_id, int value)
 {
-	QDF_STATUS ret = QDF_STATUS_SUCCESS;
+	QDF_STATUS ret;
 	tp_wma_handle wma_handle =
 			(tp_wma_handle)cds_get_context(QDF_MODULE_ID_WMA);