[PATCH 5/6] staging: ks7010: clean up return statement code

Tobin C. Harding me at tobin.cc
Tue Mar 14 10:20:16 UTC 2017


All return statement call sites and associated identifiers and goto
labels have been audited in previous patches. There remains just a few
hodgepodge refactor changes to make ks7010 super clean in regard to
function returns.

Spacing around return statement varies, we can be super pedantic and make this
uniform. And finally we can do whitespace refactor on any calls
that involve the return code 'rc' identifier (since the identifier was
previously shortened).

Refactor call sites that involve the identifier 'rc'. Make spacing
around calls to return uniform. Make whitespace changes only.

Signed-off-by: Tobin C. Harding <me at tobin.cc>
---
 drivers/staging/ks7010/ks7010_sdio.c | 16 +++++--------
 drivers/staging/ks7010/ks_hostif.c   |  1 +
 drivers/staging/ks7010/ks_wlan_net.c | 45 ++++++++++++++++++++++++++++++------
 3 files changed, 45 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/ks7010/ks7010_sdio.c b/drivers/staging/ks7010/ks7010_sdio.c
index 3a0fe44..6d6b9d5 100644
--- a/drivers/staging/ks7010/ks7010_sdio.c
+++ b/drivers/staging/ks7010/ks7010_sdio.c
@@ -318,8 +318,7 @@ static void tx_device_task(void *dev)
 		if (priv->dev_state >= DEVICE_STATE_BOOT) {
 			rc = write_to_device(priv, sp->sendp, sp->size);
 			if (rc) {
-				DPRINTK(1, "write_to_device error !!(%d)\n",
-					rc);
+				DPRINTK(1, "write_to_device error !(%d)\n", rc);
 				queue_delayed_work(priv->ks_wlan_hw.
 						   ks7010sdio_wq,
 						   &priv->ks_wlan_hw.rw_wq, 1);
@@ -404,9 +403,8 @@ static void ks_wlan_hw_rx(void *dev, uint16_t size)
 	}
 	rx_buffer = &priv->rx_dev.rx_dev_buff[priv->rx_dev.qtail];
 
-	rc =
-	    ks7010_sdio_read(priv, DATA_WINDOW, &rx_buffer->data[0],
-			     hif_align_size(size));
+	rc = ks7010_sdio_read(priv, DATA_WINDOW, &rx_buffer->data[0],
+			      hif_align_size(size));
 	if (rc)
 		return;
 
@@ -420,9 +418,8 @@ static void ks_wlan_hw_rx(void *dev, uint16_t size)
 #endif
 		/* rx_status update */
 		read_status = READ_STATUS_IDLE;
-		rc =
-		    ks7010_sdio_write(priv, READ_STATUS, &read_status,
-				      sizeof(read_status));
+		rc = ks7010_sdio_write(priv, READ_STATUS, &read_status,
+				       sizeof(read_status));
 		if (rc)
 			DPRINTK(1, " error : READ_STATUS=%02X\n", read_status);
 
@@ -1021,8 +1018,7 @@ static int ks7010_sdio_probe(struct sdio_func *func,
 	rc = ks7010_upload_firmware(priv, card);	/* firmware load */
 	if (rc) {
 		dev_err(&card->func->dev,
-			"ks7010: firmware load failed !! return code = %d\n",
-			rc);
+			"ks7010: firmware load failed! return code = %d\n", rc);
 		goto err_free_read_buf;
 	}
 
diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c
index db10e16..6fa2d55 100644
--- a/drivers/staging/ks7010/ks_hostif.c
+++ b/drivers/staging/ks7010/ks_hostif.c
@@ -101,6 +101,7 @@ int ks_wlan_do_power_save(struct ks_wlan_private *priv)
 		hostif_sme_enqueue(priv, SME_POW_MNGMT_REQUEST);
 	else
 		priv->dev_state = DEVICE_STATE_READY;
+
 	return 0;
 }
 
diff --git a/drivers/staging/ks7010/ks_wlan_net.c b/drivers/staging/ks7010/ks_wlan_net.c
index f384dd2..47a618f 100644
--- a/drivers/staging/ks7010/ks_wlan_net.c
+++ b/drivers/staging/ks7010/ks_wlan_net.c
@@ -327,6 +327,7 @@ static int ks_wlan_set_essid(struct net_device *dev,
 //      return  -EINPROGRESS;   /* Call commit handler */
 	ks_wlan_setup_parameter(priv, priv->need_commit);
 	priv->need_commit = 0;
+
 	return 0;
 }
 
@@ -407,6 +408,7 @@ static int ks_wlan_set_wap(struct net_device *dev, struct iw_request_info *info,
 		priv->need_commit |= SME_MODE_SET;
 		return -EINPROGRESS;	/* Call commit handler */
 	}
+
 	return 0;
 }
 
@@ -1006,6 +1008,7 @@ static int ks_wlan_set_encode(struct net_device *dev,
 		ks_wlan_setup_parameter(priv, priv->need_commit);
 		priv->need_commit = 0;
 	}
+
 	return 0;
 }
 
@@ -1088,6 +1091,7 @@ static int ks_wlan_get_txpow(struct net_device *dev,
 	vwrq->value = 0;
 	vwrq->disabled = (vwrq->value == 0);
 	vwrq->fixed = 1;
+
 	return 0;
 }
 
@@ -1114,6 +1118,7 @@ static int ks_wlan_get_retry(struct net_device *dev,
 	vwrq->value = 0;
 	vwrq->disabled = (vwrq->value == 0);
 	vwrq->fixed = 1;
+
 	return 0;
 }
 #endif /* KSC_OPNOTSUPP */
@@ -1349,6 +1354,7 @@ static int ks_wlan_get_sens(struct net_device *dev,
 	vwrq->value = 0;
 	vwrq->disabled = (vwrq->value == 0);
 	vwrq->fixed = 1;
+
 	return 0;
 }
 #endif /* KSC_OPNOTSUPP */
@@ -1658,6 +1664,7 @@ static int ks_wlan_config_commit(struct net_device *dev,
 
 	ks_wlan_setup_parameter(priv, priv->need_commit);
 	priv->need_commit = 0;
+
 	return 0;
 }
 
@@ -1674,9 +1681,9 @@ static int ks_wlan_set_genie(struct net_device *dev,
 
 	if (priv->sleep_mode == SLP_SLEEP)
 		return -EPERM;
+
 	/* for SLEEP MODE */
 	return 0;
-//      return -EOPNOTSUPP;
 }
 
 /*------------------------------------------------------------------*/
@@ -1813,6 +1820,7 @@ static int ks_wlan_set_auth_mode(struct net_device *dev,
 		ks_wlan_setup_parameter(priv, priv->need_commit);
 		priv->need_commit = 0;
 	}
+
 	return 0;
 }
 
@@ -1859,6 +1867,7 @@ static int ks_wlan_get_auth_mode(struct net_device *dev,
 		/* return -EOPNOTSUPP; */
 		break;
 	}
+
 	return 0;
 }
 
@@ -2093,6 +2102,7 @@ static int ks_wlan_set_pmksa(struct net_device *dev,
 	}
 
 	hostif_sme_enqueue(priv, SME_SET_PMKSA);
+
 	return 0;
 }
 
@@ -2140,6 +2150,7 @@ static int ks_wlan_set_stop_request(struct net_device *dev,
 		return -EINVAL;
 
 	hostif_sme_enqueue(priv, SME_STOP_REQUEST);
+
 	return 0;
 }
 
@@ -2183,6 +2194,7 @@ static int ks_wlan_get_firmware_version(struct net_device *dev,
 	    (struct ks_wlan_private *)netdev_priv(dev);
 	strcpy(extra, priv->firmware_version);
 	dwrq->length = priv->version_size + 1;
+
 	return 0;
 }
 
@@ -2210,6 +2222,7 @@ static int ks_wlan_set_detach(struct net_device *dev,
 	} else {
 		return -EINVAL;
 	}
+
 	return 0;
 }
 
@@ -2226,6 +2239,7 @@ static int ks_wlan_get_detach(struct net_device *dev,
 
 	/* for SLEEP MODE */
 	*uwrq = ((priv->connect_status & FORCE_DISCONNECT) ? 1 : 0);
+
 	return 0;
 }
 
@@ -2242,6 +2256,7 @@ static int ks_wlan_get_connect(struct net_device *dev,
 
 	/* for SLEEP MODE */
 	*uwrq = (priv->connect_status & CONNECT_STATUS_MASK);
+
 	return 0;
 }
 #endif
@@ -2285,6 +2300,7 @@ static int ks_wlan_get_preamble(struct net_device *dev,
 
 	/* for SLEEP MODE */
 	*uwrq = priv->reg.preamble;
+
 	return 0;
 }
 
@@ -2336,6 +2352,7 @@ static int ks_wlan_get_powermgt(struct net_device *dev,
 
 	/* for SLEEP MODE */
 	*uwrq = priv->reg.powermgt;
+
 	return 0;
 }
 
@@ -2375,6 +2392,7 @@ static int ks_wlan_get_scan_type(struct net_device *dev,
 		return -EPERM;
 	/* for SLEEP MODE */
 	*uwrq = priv->reg.scan_type;
+
 	return 0;
 }
 
@@ -2505,6 +2523,7 @@ static int ks_wlan_get_wep_ascii(struct net_device *dev,
 
 	memcpy(extra, tmp, len);
 	dwrq->length = len + 1;
+
 	return 0;
 }
 #endif
@@ -2529,9 +2548,9 @@ static int ks_wlan_set_beacon_lost(struct net_device *dev,
 	if (priv->reg.operation_mode == MODE_INFRASTRUCTURE) {
 		priv->need_commit |= SME_MODE_SET;
 		return -EINPROGRESS;	/* Call commit handler */
-	} else {
-		return 0;
 	}
+
+	return 0;
 }
 
 /*------------------------------------------------------------------*/
@@ -2547,6 +2566,7 @@ static int ks_wlan_get_beacon_lost(struct net_device *dev,
 		return -EPERM;
 	/* for SLEEP MODE */
 	*uwrq = priv->reg.beacon_lost_count;
+
 	return 0;
 }
 
@@ -2573,6 +2593,7 @@ static int ks_wlan_set_phy_type(struct net_device *dev,
 	}
 
 	priv->need_commit |= SME_MODE_SET;
+
 	return -EINPROGRESS;	/* Call commit handler */
 }
 
@@ -2589,6 +2610,7 @@ static int ks_wlan_get_phy_type(struct net_device *dev,
 		return -EPERM;
 	/* for SLEEP MODE */
 	*uwrq = priv->reg.phy_type;
+
 	return 0;
 }
 
@@ -2618,6 +2640,7 @@ static int ks_wlan_set_cts_mode(struct net_device *dev,
 	}
 
 	priv->need_commit |= SME_MODE_SET;
+
 	return -EINPROGRESS;	/* Call commit handler */
 }
 
@@ -2634,6 +2657,7 @@ static int ks_wlan_get_cts_mode(struct net_device *dev,
 		return -EPERM;
 	/* for SLEEP MODE */
 	*uwrq = priv->reg.cts_mode;
+
 	return 0;
 }
 
@@ -2716,6 +2740,7 @@ static int ks_wlan_get_phy_information_timer(struct net_device *dev,
 		return -EPERM;
 	/* for SLEEP MODE */
 	*uwrq = priv->reg.phy_info_timer;
+
 	return 0;
 }
 #endif
@@ -2814,6 +2839,7 @@ static int ks_wlan_get_wps_probe_req(struct net_device *dev,
 
 	if (priv->sleep_mode == SLP_SLEEP)
 		return -EPERM;
+
 	/* for SLEEP MODE */
 	return 0;
 }
@@ -2843,6 +2869,7 @@ static int ks_wlan_set_tx_gain(struct net_device *dev,
 		priv->gain.TxMode = 0;
 
 	hostif_sme_enqueue(priv, SME_SET_GAIN);
+
 	return 0;
 }
 
@@ -2860,6 +2887,7 @@ static int ks_wlan_get_tx_gain(struct net_device *dev,
 	/* for SLEEP MODE */
 	*uwrq = priv->gain.TxGain;
 	hostif_sme_enqueue(priv, SME_GET_GAIN);
+
 	return 0;
 }
 
@@ -2886,6 +2914,7 @@ static int ks_wlan_set_rx_gain(struct net_device *dev,
 		priv->gain.RxMode = 0;
 
 	hostif_sme_enqueue(priv, SME_SET_GAIN);
+
 	return 0;
 }
 
@@ -2903,6 +2932,7 @@ static int ks_wlan_get_rx_gain(struct net_device *dev,
 	/* for SLEEP MODE */
 	*uwrq = priv->gain.RxGain;
 	hostif_sme_enqueue(priv, SME_GET_GAIN);
+
 	return 0;
 }
 
@@ -2924,6 +2954,7 @@ static int ks_wlan_set_region(struct net_device *dev,
 		return -EINVAL;
 
 	hostif_sme_enqueue(priv, SME_SET_REGION);
+
 	return 0;
 }
 #endif
@@ -2938,6 +2969,7 @@ static int ks_wlan_get_eeprom_cksum(struct net_device *dev,
 	    (struct ks_wlan_private *)netdev_priv(dev);
 
 	*uwrq = priv->eeprom_checksum;
+
 	return 0;
 }
 
@@ -3069,6 +3101,7 @@ static int ks_wlan_hostt(struct net_device *dev, struct iw_request_info *info,
 				     SME_EVENT_BUFF_SIZE];
 		print_hif_event(dev, event);
 	}
+
 	return 0;
 }
 
@@ -3299,6 +3332,7 @@ int ks_wlan_set_mac_address(struct net_device *dev, void *addr)
 	priv->mac_address_valid = 0;
 	hostif_sme_enqueue(priv, SME_MACADDRESS_SET_REQUEST);
 	netdev_info(dev, "ks_wlan:  MAC ADDRESS = %pM\n", priv->eth_addr);
+
 	return 0;
 }
 
@@ -3337,12 +3371,9 @@ int ks_wlan_start_xmit(struct sk_buff *skb, struct net_device *dev)
 
 	rc = hostif_data_request(priv, skb);
 	netif_trans_update(dev);
-
 	DPRINTK(4, "rc=%d\n", rc);
-	if (rc)
-		rc = 0;
 
-	return rc;
+	return 0;
 }
 
 void send_packet_complete(void *arg1, void *arg2)
-- 
2.7.4



More information about the devel mailing list