Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 270e58e8 authored by Yogesh Ashok Powar's avatar Yogesh Ashok Powar Committed by John W. Linville
Browse files

mwifiex: remove unnecessary variable initialization



Skip initialization of local variables with some default values
if the values are not going to be used further down the code path.

Signed-off-by: default avatarYogesh Ashok Powar <yogeshp@marvell.com>
Signed-off-by: default avatarBing Zhao <bzhao@marvell.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 57f16b5d
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -187,7 +187,7 @@ int mwifiex_ret_11n_addba_req(struct mwifiex_private *priv,
 */
int mwifiex_ret_11n_cfg(struct host_cmd_ds_command *resp, void *data_buf)
{
	struct mwifiex_ds_11n_tx_cfg *tx_cfg = NULL;
	struct mwifiex_ds_11n_tx_cfg *tx_cfg;
	struct host_cmd_ds_11n_cfg *htcfg = &resp->params.htcfg;

	if (data_buf) {
@@ -274,7 +274,7 @@ int mwifiex_cmd_amsdu_aggr_ctrl(struct host_cmd_ds_command *cmd,
int mwifiex_ret_amsdu_aggr_ctrl(struct host_cmd_ds_command *resp,
				void *data_buf)
{
	struct mwifiex_ds_11n_amsdu_aggr_ctrl *amsdu_aggr_ctrl = NULL;
	struct mwifiex_ds_11n_amsdu_aggr_ctrl *amsdu_aggr_ctrl;
	struct host_cmd_ds_amsdu_aggr_ctrl *amsdu_ctrl =
		&resp->params.amsdu_aggr_ctrl;

@@ -461,8 +461,7 @@ mwifiex_cfg_tx_buf(struct mwifiex_private *priv,
		   struct mwifiex_bssdescriptor *bss_desc)
{
	u16 max_amsdu = MWIFIEX_TX_DATA_BUF_SIZE_2K;
	u16 tx_buf = 0;
	u16 curr_tx_buf_size = 0;
	u16 tx_buf, curr_tx_buf_size = 0;

	if (bss_desc->bcn_ht_cap) {
		if (le16_to_cpu(bss_desc->bcn_ht_cap->cap_info) &
+3 −4
Original line number Diff line number Diff line
@@ -60,7 +60,7 @@ mwifiex_11n_form_amsdu_pkt(struct sk_buff *skb_aggr,
			 * later with ethertype
			 */
	};
	struct tx_packet_hdr *tx_header = NULL;
	struct tx_packet_hdr *tx_header;

	skb_put(skb_aggr, sizeof(*tx_header));

@@ -182,7 +182,7 @@ int mwifiex_11n_deaggregate_pkt(struct mwifiex_private *priv,
	struct mwifiex_rxinfo *rx_info = MWIFIEX_SKB_RXCB(skb);
	struct rxpd *local_rx_pd = (struct rxpd *) skb->data;
	struct sk_buff *skb_daggr;
	struct mwifiex_rxinfo *rx_info_daggr = NULL;
	struct mwifiex_rxinfo *rx_info_daggr;
	int ret = -1;
	struct rx_packet_hdr *rx_pkt_hdr;
	struct mwifiex_adapter *adapter = priv->adapter;
@@ -285,8 +285,7 @@ mwifiex_11n_aggregate_pkt(struct mwifiex_private *priv,
	struct mwifiex_adapter *adapter = priv->adapter;
	struct sk_buff *skb_aggr, *skb_src;
	struct mwifiex_txinfo *tx_info_aggr, *tx_info_src;
	int pad = 0;
	int ret = 0;
	int pad = 0, ret;
	struct mwifiex_tx_param tx_param;
	struct txpd *ptx_pd = NULL;

+7 −8
Original line number Diff line number Diff line
@@ -39,7 +39,7 @@ mwifiex_11n_dispatch_pkt_until_start_win(struct mwifiex_private *priv,
					 *rx_reor_tbl_ptr, int start_win)
{
	int no_pkt_to_send, i;
	void *rx_tmp_ptr = NULL;
	void *rx_tmp_ptr;
	unsigned long flags;

	no_pkt_to_send = (start_win > rx_reor_tbl_ptr->start_win) ?
@@ -88,7 +88,7 @@ mwifiex_11n_scan_and_dispatch(struct mwifiex_private *priv,
			      struct mwifiex_rx_reorder_tbl *rx_reor_tbl_ptr)
{
	int i, j, xchg;
	void *rx_tmp_ptr = NULL;
	void *rx_tmp_ptr;
	unsigned long flags;

	for (i = 0; i < rx_reor_tbl_ptr->win_size; ++i) {
@@ -335,8 +335,8 @@ int mwifiex_cmd_11n_addba_rsp_gen(struct mwifiex_private *priv,
		&cmd->params.add_ba_rsp;
	struct host_cmd_ds_11n_addba_req *cmd_addba_req =
		(struct host_cmd_ds_11n_addba_req *) data_buf;
	u8 tid = 0;
	int win_size = 0;
	u8 tid;
	int win_size;
	uint16_t block_ack_param_set;

	cmd->command = cpu_to_le16(HostCmd_CMD_11N_ADDBA_RSP);
@@ -406,9 +406,8 @@ int mwifiex_11n_rx_reorder_pkt(struct mwifiex_private *priv,
				u8 *ta, u8 pkt_type, void *payload)
{
	struct mwifiex_rx_reorder_tbl *rx_reor_tbl_ptr;
	int start_win, end_win, win_size;
	int ret = 0;
	u16 pkt_index = 0;
	int start_win, end_win, win_size, ret;
	u16 pkt_index;

	rx_reor_tbl_ptr =
		mwifiex_11n_get_rx_reorder_tbl((struct mwifiex_private *) priv,
@@ -540,7 +539,7 @@ int mwifiex_ret_11n_addba_resp(struct mwifiex_private *priv,
		(struct host_cmd_ds_11n_addba_rsp *)
		&resp->params.add_ba_rsp;
	int tid, win_size;
	struct mwifiex_rx_reorder_tbl *rx_reor_tbl_ptr = NULL;
	struct mwifiex_rx_reorder_tbl *rx_reor_tbl_ptr;
	uint16_t block_ack_param_set;

	block_ack_param_set = le16_to_cpu(add_ba_rsp->block_ack_param_set);
+9 −14
Original line number Diff line number Diff line
@@ -77,18 +77,15 @@ mwifiex_channels_to_cfg80211_channel_type(int channel_type)
static int
mwifiex_is_alg_wep(u32 cipher)
{
	int alg = 0;

	switch (cipher) {
	case WLAN_CIPHER_SUITE_WEP40:
	case WLAN_CIPHER_SUITE_WEP104:
		alg = 1;
		break;
		return 1;
	default:
		alg = 0;
		break;
	}
	return alg;

	return 0;
}

/*
@@ -408,7 +405,7 @@ mwifiex_cfg80211_set_channel(struct wiphy *wiphy, struct net_device *dev,
static int
mwifiex_set_frag(struct mwifiex_private *priv, u32 frag_thr)
{
	int ret = 0;
	int ret;

	if (frag_thr < MWIFIEX_FRAG_MIN_VALUE
	    || frag_thr > MWIFIEX_FRAG_MAX_VALUE)
@@ -449,7 +446,6 @@ static int
mwifiex_cfg80211_set_wiphy_params(struct wiphy *wiphy, u32 changed)
{
	struct mwifiex_private *priv = mwifiex_cfg80211_get_priv(wiphy);

	int ret = 0;

	if (changed & WIPHY_PARAM_RTS_THRESHOLD) {
@@ -473,7 +469,7 @@ mwifiex_cfg80211_change_virtual_intf(struct wiphy *wiphy,
				     enum nl80211_iftype type, u32 *flags,
				     struct vif_params *params)
{
	int ret = 0;
	int ret;
	struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev);

	if (priv->bss_mode == type) {
@@ -717,7 +713,7 @@ static int mwifiex_cfg80211_inform_ibss_bss(struct mwifiex_private *priv)
{
	struct ieee80211_channel *chan;
	struct mwifiex_bss_info bss_info;
	int ie_len = 0;
	int ie_len;
	u8 ie_buf[IEEE80211_MAX_SSID_LEN + sizeof(struct ieee_types_header)];

	if (mwifiex_get_bss_info(priv, &bss_info))
@@ -903,8 +899,7 @@ mwifiex_cfg80211_assoc(struct mwifiex_private *priv, size_t ssid_len, u8 *ssid,
{
	struct mwifiex_802_11_ssid req_ssid;
	struct mwifiex_ssid_bssid ssid_bssid;
	int ret = 0;
	int auth_type = 0;
	int ret, auth_type = 0;

	memset(&req_ssid, 0, sizeof(struct mwifiex_802_11_ssid));
	memset(&ssid_bssid, 0, sizeof(struct mwifiex_ssid_bssid));
@@ -1247,8 +1242,8 @@ static struct cfg80211_ops mwifiex_cfg80211_ops = {
int mwifiex_register_cfg80211(struct net_device *dev, u8 *mac,
			      struct mwifiex_private *priv)
{
	int ret = 0;
	void *wdev_priv = NULL;
	int ret;
	void *wdev_priv;
	struct wireless_dev *wdev;

	wdev = kzalloc(sizeof(struct wireless_dev), GFP_KERNEL);
+14 −14
Original line number Diff line number Diff line
@@ -128,7 +128,7 @@ static int mwifiex_dnld_cmd_to_fw(struct mwifiex_private *priv,
{

	struct mwifiex_adapter *adapter = priv->adapter;
	int ret = 0;
	int ret;
	struct host_cmd_ds_command *host_cmd;
	uint16_t cmd_code;
	uint16_t cmd_size;
@@ -222,8 +222,8 @@ static int mwifiex_dnld_cmd_to_fw(struct mwifiex_private *priv,
 */
static int mwifiex_dnld_sleep_confirm_cmd(struct mwifiex_adapter *adapter)
{
	int ret = 0;
	u16 cmd_len = 0;
	int ret;
	u16 cmd_len;
	struct mwifiex_private *priv;
	struct mwifiex_opt_sleep_confirm_buffer *sleep_cfm_buf =
				(struct mwifiex_opt_sleep_confirm_buffer *)
@@ -364,13 +364,13 @@ int mwifiex_free_cmd_buffer(struct mwifiex_adapter *adapter)
 */
int mwifiex_process_event(struct mwifiex_adapter *adapter)
{
	int ret = 0;
	int ret;
	struct mwifiex_private *priv =
		mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY);
	struct sk_buff *skb = adapter->event_skb;
	u32 eventcause = adapter->event_cause;
	struct timeval tstamp;
	struct mwifiex_rxinfo *rx_info = NULL;
	struct mwifiex_rxinfo *rx_info;

	/* Save the last event to debug log */
	adapter->dbg.last_event_index =
@@ -446,10 +446,10 @@ int mwifiex_send_cmd_sync(struct mwifiex_private *priv, uint16_t cmd_no,
int mwifiex_send_cmd_async(struct mwifiex_private *priv, uint16_t cmd_no,
			   u16 cmd_action, u32 cmd_oid, void *data_buf)
{
	int ret = 0;
	int ret;
	struct mwifiex_adapter *adapter = priv->adapter;
	struct cmd_ctrl_node *cmd_node = NULL;
	struct host_cmd_ds_command *cmd_ptr = NULL;
	struct cmd_ctrl_node *cmd_node;
	struct host_cmd_ds_command *cmd_ptr;

	if (!adapter) {
		pr_err("PREP_CMD: adapter is NULL\n");
@@ -605,8 +605,8 @@ mwifiex_insert_cmd_to_pending_q(struct mwifiex_adapter *adapter,
 */
int mwifiex_exec_next_cmd(struct mwifiex_adapter *adapter)
{
	struct mwifiex_private *priv = NULL;
	struct cmd_ctrl_node *cmd_node = NULL;
	struct mwifiex_private *priv;
	struct cmd_ctrl_node *cmd_node;
	int ret = 0;
	struct host_cmd_ds_command *host_cmd;
	unsigned long cmd_flags;
@@ -673,7 +673,7 @@ int mwifiex_exec_next_cmd(struct mwifiex_adapter *adapter)
 */
int mwifiex_process_cmdresp(struct mwifiex_adapter *adapter)
{
	struct host_cmd_ds_command *resp = NULL;
	struct host_cmd_ds_command *resp;
	struct mwifiex_private *priv =
		mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY);
	int ret = 0;
@@ -805,7 +805,7 @@ mwifiex_cmd_timeout_func(unsigned long function_context)
{
	struct mwifiex_adapter *adapter =
		(struct mwifiex_adapter *) function_context;
	struct cmd_ctrl_node *cmd_node = NULL;
	struct cmd_ctrl_node *cmd_node;
	struct timeval tstamp;

	adapter->num_cmd_timeout++;
@@ -877,7 +877,7 @@ mwifiex_cmd_timeout_func(unsigned long function_context)
void
mwifiex_cancel_all_pending_cmd(struct mwifiex_adapter *adapter)
{
	struct cmd_ctrl_node *cmd_node = NULL, *tmp_node = NULL;
	struct cmd_ctrl_node *cmd_node = NULL, *tmp_node;
	unsigned long flags;

	/* Cancel current cmd */
@@ -1160,7 +1160,7 @@ int mwifiex_cmd_enh_power_mode(struct mwifiex_private *priv,
{
	struct host_cmd_ds_802_11_ps_mode_enh *psmode_enh =
		&cmd->params.psmode_enh;
	u8 *tlv = NULL;
	u8 *tlv;
	u16 cmd_size = 0;

	cmd->command = cpu_to_le16(HostCmd_CMD_802_11_PS_MODE_ENH);
Loading