All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: rtl8192e: fix coding style issue, improve error handling
@ 2017-03-07  7:09 Suniel Mahesh
  2017-03-07 17:12 ` Dan Carpenter
  2017-03-09 18:50 ` [PATCH] staging: rtl8192e: fix coding style issue, improve error handling kbuild test robot
  0 siblings, 2 replies; 40+ messages in thread
From: Suniel Mahesh @ 2017-03-07  7:09 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel, suniel.spartan

Fix coding style issue and comments in rtl_core.c
Return -ENOMEM, if it is out of memory
Pointer comparison with NULL replaced by logical NOT

Signed-off-by: Suniel Mahesh <sunil.m@techveda.org>
---
 drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 253 +++++++++++----------------
 1 file changed, 100 insertions(+), 153 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
index 4c0caa6..1099c94 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
@@ -1,4 +1,4 @@
-/******************************************************************************
+/************************************************************************
  * Copyright(c) 2008 - 2010 Realtek Corporation. All rights reserved.
  *
  * Based on the r8180 driver, which is:
@@ -17,7 +17,7 @@
  *
  * Contact Information:
  * wlanfae <wlanfae@realtek.com>
-******************************************************************************/
+ *************************************************************************/
 #include <linux/uaccess.h>
 #include <linux/pci.h>
 #include <linux/vmalloc.h>
@@ -37,7 +37,6 @@
 static int channels = 0x3fff;
 static char *ifname = "wlan%d";
 
-
 static const struct rtl819x_ops rtl819xp_ops = {
 	.nic_type			= NIC_8192E,
 	.get_eeprom_size		= rtl92e_get_eeprom_size,
@@ -100,9 +99,7 @@ static void _rtl92e_hard_data_xmit(struct sk_buff *skb, struct net_device *dev,
 static int _rtl92e_down(struct net_device *dev, bool shutdownrf);
 static void _rtl92e_restart(void *data);
 
-/****************************************************************************
-   -----------------------------IO STUFF-------------------------
-*****************************************************************************/
+/* IO STUFF */
 
 u8 rtl92e_readb(struct net_device *dev, int x)
 {
@@ -140,9 +137,7 @@ void rtl92e_writew(struct net_device *dev, int x, u16 y)
 	udelay(20);
 }
 
-/****************************************************************************
-   -----------------------------GENERAL FUNCTION-------------------------
-*****************************************************************************/
+/* GENERAL FUNCTION */
 bool rtl92e_set_rf_state(struct net_device *dev,
 			 enum rt_rf_power_state StateToSet,
 			 RT_RF_CHANGE_SOURCE ChangeSource)
@@ -200,7 +195,6 @@ bool rtl92e_set_rf_state(struct net_device *dev,
 			priv->rtllib->RfOffReason = 0;
 			bActionAllowed = true;
 
-
 			if (rtState == eRfOff &&
 			    ChangeSource >= RF_CHANGE_BY_HW)
 				bConnectBySSID = true;
@@ -223,7 +217,8 @@ bool rtl92e_set_rf_state(struct net_device *dev,
 				else
 					priv->blinked_ingpio = false;
 				rtllib_MgntDisconnect(priv->rtllib,
-						      WLAN_REASON_DISASSOC_STA_HAS_LEFT);
+						      WLAN_REASON_DISASSOC_STA_
+								HAS_LEFT);
 			}
 		}
 		if ((ChangeSource == RF_CHANGE_BY_HW) && !priv->bHwRadioOff)
@@ -247,7 +242,6 @@ bool rtl92e_set_rf_state(struct net_device *dev,
 			 StateToSet, priv->rtllib->RfOffReason);
 		PHY_SetRFPowerState(dev, StateToSet);
 		if (StateToSet == eRfOn) {
-
 			if (bConnectBySSID && priv->blinked_ingpio) {
 				schedule_delayed_work(
 					 &ieee->associate_procedure_wq, 0);
@@ -346,16 +340,16 @@ static void _rtl92e_update_cap(struct net_device *dev, u16 cap)
 		}
 	}
 
-	if (net->mode & (IEEE_G|IEEE_N_24G)) {
+	if (net->mode & (IEEE_G | IEEE_N_24G)) {
 		u8	slot_time_val;
 		u8	CurSlotTime = priv->slot_time;
 
 		if ((cap & WLAN_CAPABILITY_SHORT_SLOT_TIME) &&
-		   (!priv->rtllib->pHTInfo->bCurrentRT2RTLongSlotTime)) {
+		    (!priv->rtllib->pHTInfo->bCurrentRT2RTLongSlotTime)) {
 			if (CurSlotTime != SHORT_SLOT_TIME) {
 				slot_time_val = SHORT_SLOT_TIME;
 				priv->rtllib->SetHwRegHandler(dev,
-					 HW_VAR_SLOT_TIME, &slot_time_val);
+				HW_VAR_SLOT_TIME, &slot_time_val);
 			}
 		} else {
 			if (CurSlotTime != NON_SHORT_SLOT_TIME) {
@@ -407,7 +401,6 @@ static void _rtl92e_qos_activate(void *data)
 	for (i = 0; i <  QOS_QUEUE_NUM; i++)
 		priv->rtllib->SetHwRegHandler(dev, HW_VAR_AC_PARAM, (u8 *)(&i));
 
-
 success:
 	mutex_unlock(&priv->mutex);
 }
@@ -427,16 +420,16 @@ static int _rtl92e_qos_handle_probe_response(struct r8192_priv *priv,
 
 	if (network->flags & NETWORK_HAS_QOS_MASK) {
 		if (active_network &&
-				(network->flags & NETWORK_HAS_QOS_PARAMETERS))
+		    (network->flags & NETWORK_HAS_QOS_PARAMETERS))
 			network->qos_data.active = network->qos_data.supported;
 
 		if ((network->qos_data.active == 1) && (active_network == 1) &&
-				(network->flags & NETWORK_HAS_QOS_PARAMETERS) &&
-				(network->qos_data.old_param_count !=
-				network->qos_data.param_count)) {
+		    (network->flags & NETWORK_HAS_QOS_PARAMETERS) &&
+		     (network->qos_data.old_param_count !=
+			network->qos_data.param_count)) {
 			network->qos_data.old_param_count =
 				network->qos_data.param_count;
-	priv->rtllib->wmm_acm = network->qos_data.wmm_acm;
+			priv->rtllib->wmm_acm = network->qos_data.wmm_acm;
 			schedule_work(&priv->qos_activate);
 			RT_TRACE(COMP_QOS,
 				 "QoS parameters change call qos_activate\n");
@@ -467,7 +460,6 @@ static int _rtl92e_handle_beacon(struct net_device *dev,
 
 	schedule_delayed_work(&priv->update_beacon_wq, 0);
 	return 0;
-
 }
 
 static int _rtl92e_qos_assoc_resp(struct r8192_priv *priv,
@@ -477,7 +469,7 @@ static int _rtl92e_qos_assoc_resp(struct r8192_priv *priv,
 	u32 size = sizeof(struct rtllib_qos_parameters);
 	int set_qos_param = 0;
 
-	if ((priv == NULL) || (network == NULL))
+	if (!priv || !network)
 		return 0;
 
 	if (priv->rtllib->state != RTLLIB_LINKED)
@@ -500,7 +492,7 @@ static int _rtl92e_qos_assoc_resp(struct r8192_priv *priv,
 			network->qos_data.param_count;
 	} else {
 		memcpy(&priv->rtllib->current_network.qos_data.parameters,
-		&def_qos_parameters, size);
+		       &def_qos_parameters, size);
 		priv->rtllib->current_network.qos_data.active = 0;
 		priv->rtllib->current_network.qos_data.supported = 0;
 		set_qos_param = 1;
@@ -518,8 +510,8 @@ static int _rtl92e_qos_assoc_resp(struct r8192_priv *priv,
 }
 
 static int _rtl92e_handle_assoc_response(struct net_device *dev,
-				 struct rtllib_assoc_response_frame *resp,
-				 struct rtllib_network *network)
+					 struct rtllib_assoc_response_frame
+					 *resp, struct rtllib_network *network)
 {
 	struct r8192_priv *priv = rtllib_priv(dev);
 
@@ -680,7 +672,7 @@ static u8 _rtl92e_get_supported_wireless_mode(struct net_device *dev)
 	case RF_8256:
 	case RF_6052:
 	case RF_PSEUDO_11N:
-		ret = (WIRELESS_MODE_N_24G|WIRELESS_MODE_G | WIRELESS_MODE_B);
+		ret = (WIRELESS_MODE_N_24G | WIRELESS_MODE_G | WIRELESS_MODE_B);
 		break;
 	case RF_8258:
 		ret = (WIRELESS_MODE_A | WIRELESS_MODE_N_5G);
@@ -742,7 +734,7 @@ static int _rtl92e_sta_up(struct net_device *dev, bool is_silent_reset)
 {
 	struct r8192_priv *priv = rtllib_priv(dev);
 	struct rt_pwr_save_ctrl *pPSC = (struct rt_pwr_save_ctrl *)
-					(&(priv->rtllib->PowerSaveControl));
+					&priv->rtllib->PowerSaveControl;
 	bool init_status = true;
 
 	priv->bDriverIsGoingToUnload = false;
@@ -790,7 +782,7 @@ static int _rtl92e_sta_down(struct net_device *dev, bool shutdownrf)
 	if (priv->up == 0)
 		return -1;
 
-	if (priv->rtllib->rtllib_ips_leave != NULL)
+	if (priv->rtllib->rtllib_ips_leave)
 		priv->rtllib->rtllib_ips_leave(dev);
 
 	if (priv->rtllib->state == RTLLIB_LINKED)
@@ -888,12 +880,11 @@ static void _rtl92e_init_priv_constant(struct net_device *dev)
 {
 	struct r8192_priv *priv = rtllib_priv(dev);
 	struct rt_pwr_save_ctrl *pPSC = (struct rt_pwr_save_ctrl *)
-					&(priv->rtllib->PowerSaveControl);
+					&priv->rtllib->PowerSaveControl;
 
 	pPSC->RegMaxLPSAwakeIntvl = 5;
 }
 
-
 static void _rtl92e_init_priv_variable(struct net_device *dev)
 {
 	struct r8192_priv *priv = rtllib_priv(dev);
@@ -976,9 +967,7 @@ static void _rtl92e_init_priv_variable(struct net_device *dev)
 
 	priv->pFirmware = vzalloc(sizeof(struct rt_firmware));
 	if (!priv->pFirmware)
-		netdev_err(dev,
-			   "rtl8192e: Unable to allocate space for firmware\n");
-
+		return -ENOMEM;
 	skb_queue_head_init(&priv->skb_queue);
 
 	for (i = 0; i < MAX_QUEUE_SIZE; i++)
@@ -1015,9 +1004,9 @@ static void _rtl92e_init_priv_task(struct net_device *dev)
 			      (void *)_rtl92e_update_beacon, dev);
 	INIT_WORK_RSL(&priv->qos_activate, (void *)_rtl92e_qos_activate, dev);
 	INIT_DELAYED_WORK_RSL(&priv->rtllib->hw_wakeup_wq,
-			      (void *) rtl92e_hw_wakeup_wq, dev);
+			      (void *)rtl92e_hw_wakeup_wq, dev);
 	INIT_DELAYED_WORK_RSL(&priv->rtllib->hw_sleep_wq,
-			      (void *) rtl92e_hw_sleep_wq, dev);
+			      (void *)rtl92e_hw_sleep_wq, dev);
 	tasklet_init(&priv->irq_rx_tasklet,
 		     (void(*)(unsigned long))_rtl92e_irq_rx_tasklet,
 		     (unsigned long)priv);
@@ -1035,8 +1024,8 @@ static short _rtl92e_get_channel_map(struct net_device *dev)
 
 	struct r8192_priv *priv = rtllib_priv(dev);
 
-	if ((priv->rf_chip != RF_8225) && (priv->rf_chip != RF_8256)
-			&& (priv->rf_chip != RF_6052)) {
+	if ((priv->rf_chip != RF_8225) && (priv->rf_chip != RF_8256) &&
+	    (priv->rf_chip != RF_6052)) {
 		netdev_err(dev, "%s: unknown rf chip, can't set channel map\n",
 			   __func__);
 		return -1;
@@ -1062,7 +1051,7 @@ static short _rtl92e_init(struct net_device *dev)
 {
 	struct r8192_priv *priv = rtllib_priv(dev);
 
-	memset(&(priv->stats), 0, sizeof(struct rt_stats));
+	memset(&priv->stats, 0, sizeof(struct rt_stats));
 
 	_rtl92e_init_priv_handler(dev);
 	_rtl92e_init_priv_constant(dev);
@@ -1077,7 +1066,7 @@ static short _rtl92e_init(struct net_device *dev)
 
 	setup_timer(&priv->watch_dog_timer,
 		    _rtl92e_watchdog_timer_cb,
-		    (unsigned long) dev);
+		    (unsigned long)dev);
 
 	setup_timer(&priv->gpio_polling_timer,
 		    rtl92e_check_rfctrl_gpio_timer,
@@ -1101,9 +1090,7 @@ static short _rtl92e_init(struct net_device *dev)
 	return 0;
 }
 
-/***************************************************************************
-	-------------------------------WATCHDOG STUFF---------------------------
-***************************************************************************/
+/* WATCHDOG STUFF */
 static short _rtl92e_is_tx_queue_empty(struct net_device *dev)
 {
 	int i = 0;
@@ -1114,7 +1101,8 @@ static short _rtl92e_is_tx_queue_empty(struct net_device *dev)
 			continue;
 		if (skb_queue_len(&(&priv->tx_ring[i])->queue) > 0) {
 			netdev_info(dev, "===>tx queue is not empty:%d, %d\n",
-			       i, skb_queue_len(&(&priv->tx_ring[i])->queue));
+				    i,
+				    skb_queue_len(&(&priv->tx_ring[i])->queue));
 			return 0;
 		}
 	}
@@ -1134,7 +1122,7 @@ static enum reset_type _rtl92e_tx_check_stuck(struct net_device *dev)
 	switch (priv->rtllib->ps) {
 	case RTLLIB_PS_DISABLED:
 		break;
-	case (RTLLIB_PS_MBCAST|RTLLIB_PS_UNICAST):
+	case (RTLLIB_PS_MBCAST | RTLLIB_PS_UNICAST):
 		break;
 	default:
 		break;
@@ -1219,7 +1207,6 @@ static enum reset_type _rtl92e_if_check_reset(struct net_device *dev)
 	} else {
 		return RESET_TYPE_NORESET;
 	}
-
 }
 
 static void _rtl92e_if_silent_reset(struct net_device *dev)
@@ -1231,11 +1218,8 @@ static void _rtl92e_if_silent_reset(struct net_device *dev)
 	unsigned long flag;
 
 	if (priv->ResetProgress == RESET_TYPE_NORESET) {
-
 		RT_TRACE(COMP_RESET, "=========>Reset progress!!\n");
-
 		priv->ResetProgress = RESET_TYPE_SILENT;
-
 		spin_lock_irqsave(&priv->rf_ps_lock, flag);
 		if (priv->RFChangeInProgress) {
 			spin_unlock_irqrestore(&priv->rf_ps_lock, flag);
@@ -1260,16 +1244,14 @@ static void _rtl92e_if_silent_reset(struct net_device *dev)
 		}
 		priv->up = 0;
 
-		RT_TRACE(COMP_RESET, "%s():======>start to down the driver\n",
-			  __func__);
+		RT_TRACE(COMP_RESET, "%s():======>start to down the
+			 driver\n",  __func__);
 		mdelay(1000);
 		RT_TRACE(COMP_RESET,
-			 "%s():111111111111111111111111======>start to down the driver\n",
-			 __func__);
-
+			 "%s():111111111111111111111111======>start to down the
+			 driver\n",  __func__);
 		if (!netif_queue_stopped(dev))
 			netif_stop_queue(dev);
-
 		rtl92e_irq_disable(dev);
 		del_timer_sync(&priv->watch_dog_timer);
 		_rtl92e_cancel_deferred_work(priv);
@@ -1387,7 +1369,7 @@ static void _rtl92e_watchdog_wq_cb(void *data)
 	static u8 check_reset_cnt;
 	unsigned long flags;
 	struct rt_pwr_save_ctrl *pPSC = (struct rt_pwr_save_ctrl *)
-					(&(priv->rtllib->PowerSaveControl));
+					 &priv->rtllib->PowerSaveControl;
 	bool bBusyTraffic = false;
 	bool	bHigherBusyTraffic = false;
 	bool	bHigherBusyRxTraffic = false;
@@ -1422,10 +1404,9 @@ static void _rtl92e_watchdog_wq_cb(void *data)
 	if ((ieee->state == RTLLIB_LINKED) && (ieee->iw_mode ==
 	     IW_MODE_INFRA) && (!ieee->bNetPromiscuousMode)) {
 		if (ieee->LinkDetectInfo.NumRxOkInPeriod > 100 ||
-		ieee->LinkDetectInfo.NumTxOkInPeriod > 100)
+		    ieee->LinkDetectInfo.NumTxOkInPeriod > 100)
 			bBusyTraffic = true;
 
-
 		if (ieee->LinkDetectInfo.NumRxOkInPeriod > 4000 ||
 		    ieee->LinkDetectInfo.NumTxOkInPeriod > 4000) {
 			bHigherBusyTraffic = true;
@@ -1469,12 +1450,11 @@ static void _rtl92e_watchdog_wq_cb(void *data)
 
 		_rtl92e_update_rxcounts(priv, &TotalRxBcnNum, &TotalRxDataNum);
 
-		if ((TotalRxBcnNum+TotalRxDataNum) == 0)
+		if ((TotalRxBcnNum + TotalRxDataNum) == 0)
 			priv->check_roaming_cnt++;
 		else
 			priv->check_roaming_cnt = 0;
 
-
 		if (priv->check_roaming_cnt > 0) {
 			if (ieee->eRFPowerState == eRfOff)
 				netdev_info(dev, "%s(): RF is off\n", __func__);
@@ -1493,11 +1473,10 @@ static void _rtl92e_watchdog_wq_cb(void *data)
 			if (ieee->LedControlHandler)
 				ieee->LedControlHandler(ieee->dev,
 							LED_CTL_START_TO_LINK);
-
 			notify_wx_assoc_event(ieee);
 
 			if (!(ieee->rtllib_ap_sec_type(ieee) &
-			     (SEC_ALG_CCMP|SEC_ALG_TKIP)))
+			     (SEC_ALG_CCMP | SEC_ALG_TKIP)))
 				schedule_delayed_work(
 					&ieee->associate_procedure_wq, 0);
 
@@ -1505,9 +1484,7 @@ static void _rtl92e_watchdog_wq_cb(void *data)
 		}
 		ieee->LinkDetectInfo.NumRecvBcnInPeriod = 0;
 		ieee->LinkDetectInfo.NumRecvDataInPeriod = 0;
-
 	}
-
 	spin_lock_irqsave(&priv->tx_lock, flags);
 	if ((check_reset_cnt++ >= 3) && (!ieee->is_roaming) &&
 	    (!priv->RFChangeInProgress) && (!pPSC->bSwRfProcessing)) {
@@ -1523,7 +1500,7 @@ static void _rtl92e_watchdog_wq_cb(void *data)
 	}
 
 	if (((priv->force_reset) || (!priv->bDisableNormalResetCheck &&
-	      ResetType == RESET_TYPE_SILENT)))
+				     ResetType == RESET_TYPE_SILENT)))
 		_rtl92e_if_silent_reset(dev);
 	priv->force_reset = false;
 	priv->bForcedSilentReset = false;
@@ -1540,9 +1517,7 @@ static void _rtl92e_watchdog_timer_cb(unsigned long data)
 		  msecs_to_jiffies(RTLLIB_WATCH_DOG_TIME));
 }
 
-/****************************************************************************
- ---------------------------- NIC TX/RX STUFF---------------------------
-*****************************************************************************/
+/* NIC TX/RX STUFF */
 void rtl92e_rx_enable(struct net_device *dev)
 {
 	struct r8192_priv *priv = rtllib_priv(dev);
@@ -1559,7 +1534,6 @@ void rtl92e_tx_enable(struct net_device *dev)
 	rtllib_reset_queue(priv->rtllib);
 }
 
-
 static void _rtl92e_free_rx_ring(struct net_device *dev)
 {
 	struct r8192_priv *priv = rtllib_priv(dev);
@@ -1573,17 +1547,16 @@ static void _rtl92e_free_rx_ring(struct net_device *dev)
 			if (!skb)
 				continue;
 
-			pci_unmap_single(priv->pdev,
-				*((dma_addr_t *)skb->cb),
-				priv->rxbuffersize, PCI_DMA_FROMDEVICE);
+			pci_unmap_single(priv->pdev, *((dma_addr_t *)skb->cb),
+					 priv->rxbuffersize,
+					 PCI_DMA_FROMDEVICE);
 				kfree_skb(skb);
 		}
-
 		pci_free_consistent(priv->pdev,
-			sizeof(*priv->rx_ring[rx_queue_idx]) *
-			priv->rxringcount,
-			priv->rx_ring[rx_queue_idx],
-			priv->rx_ring_dma[rx_queue_idx]);
+				    sizeof(*priv->rx_ring[rx_queue_idx]) *
+				    priv->rxringcount,
+				    priv->rx_ring[rx_queue_idx],
+				    priv->rx_ring_dma[rx_queue_idx]);
 		priv->rx_ring[rx_queue_idx] = NULL;
 	}
 }
@@ -1598,13 +1571,13 @@ static void _rtl92e_free_tx_ring(struct net_device *dev, unsigned int prio)
 		struct sk_buff *skb = __skb_dequeue(&ring->queue);
 
 		pci_unmap_single(priv->pdev, entry->TxBuffAddr,
-			skb->len, PCI_DMA_TODEVICE);
+				 skb->len, PCI_DMA_TODEVICE);
 		kfree_skb(skb);
 		ring->idx = (ring->idx + 1) % ring->entries;
 	}
 
-	pci_free_consistent(priv->pdev, sizeof(*ring->desc)*ring->entries,
-	ring->desc, ring->dma);
+	pci_free_consistent(priv->pdev, sizeof(*ring->desc) * ring->entries,
+			    ring->desc, ring->dma);
 	ring->desc = NULL;
 }
 
@@ -1618,7 +1591,7 @@ static void _rtl92e_hard_data_xmit(struct sk_buff *skb, struct net_device *dev,
 	u8 queue_index = tcb_desc->queue_index;
 
 	if ((priv->rtllib->eRFPowerState == eRfOff) || !priv->up ||
-	     priv->bResetInProgress) {
+	    priv->bResetInProgress) {
 		kfree_skb(skb);
 		return;
 	}
@@ -1650,7 +1623,7 @@ static int _rtl92e_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
 
 	if (queue_index != TXCMD_QUEUE) {
 		if ((priv->rtllib->eRFPowerState == eRfOff) ||
-		     !priv->up || priv->bResetInProgress) {
+		    !priv->up || priv->bResetInProgress) {
 			kfree_skb(skb);
 			return 0;
 		}
@@ -1691,8 +1664,7 @@ static void _rtl92e_tx_isr(struct net_device *dev, int prio)
 
 		skb = __skb_dequeue(&ring->queue);
 		pci_unmap_single(priv->pdev, entry->TxBuffAddr,
-		skb->len, PCI_DMA_TODEVICE);
-
+				 skb->len, PCI_DMA_TODEVICE);
 		kfree_skb(skb);
 	}
 	if (prio != BEACON_QUEUE)
@@ -1712,7 +1684,7 @@ static void _rtl92e_tx_cmd(struct net_device *dev, struct sk_buff *skb)
 	ring = &priv->tx_ring[TXCMD_QUEUE];
 
 	idx = (ring->idx + skb_queue_len(&ring->queue)) % ring->entries;
-	entry = (struct tx_desc_cmd *) &ring->desc[idx];
+	entry = (struct tx_desc_cmd *)&ring->desc[idx];
 
 	tcb_desc = (struct cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE);
 
@@ -1806,7 +1778,8 @@ static short _rtl92e_alloc_rx_ring(struct net_device *dev)
 
 	for (rx_queue_idx = 0; rx_queue_idx < MAX_RX_QUEUE; rx_queue_idx++) {
 		priv->rx_ring[rx_queue_idx] = pci_zalloc_consistent(priv->pdev,
-					      sizeof(*priv->rx_ring[rx_queue_idx]) * priv->rxringcount,
+					      sizeof(*priv->rx_ring[
+					rx_queue_idx]) * priv->rxringcount,
 					      &priv->rx_ring_dma[rx_queue_idx]);
 		if (!priv->rx_ring[rx_queue_idx] ||
 		    (unsigned long)priv->rx_ring[rx_queue_idx] & 0xFF) {
@@ -1961,13 +1934,11 @@ long rtl92e_translate_to_dbm(struct r8192_priv *priv, u8 signal_strength_index)
 	return signal_power;
 }
 
-
 void rtl92e_update_rx_statistics(struct r8192_priv *priv,
 				 struct rtllib_rx_stats *pprevious_stats)
 {
 	int weighting = 0;
 
-
 	if (priv->stats.recv_signal_power == 0)
 		priv->stats.recv_signal_power =
 					 pprevious_stats->RecvSignalPower;
@@ -2017,8 +1988,6 @@ void rtl92e_copy_mpdu_stats(struct rtllib_rx_stats *psrc_stats,
 	ptarget_stats->bFirstMPDU = psrc_stats->bFirstMPDU;
 }
 
-
-
 static void _rtl92e_rx_normal(struct net_device *dev)
 {
 	struct r8192_priv *priv = rtllib_priv(dev);
@@ -2031,7 +2000,7 @@ static void _rtl92e_rx_normal(struct net_device *dev)
 
 	struct rtllib_rx_stats stats = {
 		.signal = 0,
-		.noise = (u8) -98,
+		.noise = (u8)-98,
 		.rate = 0,
 		.freq = RTLLIB_24GHZ_BAND,
 	};
@@ -2049,7 +2018,7 @@ static void _rtl92e_rx_normal(struct net_device *dev)
 		if (pdesc->OWN)
 			return;
 		if (!priv->ops->rx_query_status_descriptor(dev, &stats,
-		pdesc, skb))
+							   pdesc, skb))
 			goto done;
 		new_skb = dev_alloc_skb(priv->rxbuffersize);
 		/* if allocation of new skb failed - drop current packet
@@ -2059,13 +2028,13 @@ static void _rtl92e_rx_normal(struct net_device *dev)
 			goto done;
 
 		pci_unmap_single(priv->pdev,
-				*((dma_addr_t *)skb->cb),
-				priv->rxbuffersize,
-				PCI_DMA_FROMDEVICE);
+				 *((dma_addr_t *)skb->cb),
+				 priv->rxbuffersize,
+				 PCI_DMA_FROMDEVICE);
 
 		skb_put(skb, pdesc->Length);
 		skb_reserve(skb, stats.RxDrvInfoSize +
-			stats.RxBufShift);
+			    stats.RxBufShift);
 		skb_trim(skb, skb->len - 4/*sCrcLng*/);
 		rtllib_hdr = (struct rtllib_hdr_1addr *)skb->data;
 		if (!is_multicast_ether_addr(rtllib_hdr->addr1)) {
@@ -2104,7 +2073,7 @@ static void _rtl92e_rx_normal(struct net_device *dev)
 
 		priv->rx_buf[rx_queue_idx][priv->rx_idx[rx_queue_idx]] =
 								 skb;
-		*((dma_addr_t *) skb->cb) = pci_map_single(priv->pdev,
+		*((dma_addr_t *)skb->cb) = pci_map_single(priv->pdev,
 					    skb_tail_pointer_rsl(skb),
 					    priv->rxbuffersize,
 					    PCI_DMA_FROMDEVICE);
@@ -2117,12 +2086,11 @@ static void _rtl92e_rx_normal(struct net_device *dev)
 		pdesc->BufferAddress = *((dma_addr_t *)skb->cb);
 		pdesc->OWN = 1;
 		pdesc->Length = priv->rxbuffersize;
-		if (priv->rx_idx[rx_queue_idx] == priv->rxringcount-1)
+		if (priv->rx_idx[rx_queue_idx] == priv->rxringcount - 1)
 			pdesc->EOR = 1;
 		priv->rx_idx[rx_queue_idx] = (priv->rx_idx[rx_queue_idx] + 1) %
 					      priv->rxringcount;
 	}
-
 }
 
 static void _rtl92e_tx_resume(struct net_device *dev)
@@ -2135,7 +2103,8 @@ static void _rtl92e_tx_resume(struct net_device *dev)
 	for (queue_index = BK_QUEUE;
 	     queue_index < MAX_QUEUE_SIZE; queue_index++) {
 		while ((!skb_queue_empty(&ieee->skb_waitQ[queue_index])) &&
-		(priv->rtllib->check_nic_enough_desc(dev, queue_index) > 0)) {
+		       (priv->rtllib->check_nic_enough_desc(dev,
+							    queue_index) > 0)) {
 			skb = skb_dequeue(&ieee->skb_waitQ[queue_index]);
 			ieee->softmac_data_hard_start_xmit(skb, dev, 0);
 		}
@@ -2155,9 +2124,7 @@ static void _rtl92e_irq_rx_tasklet(struct r8192_priv *priv)
 		      rtl92e_readl(priv->rtllib->dev, INTA_MASK) | IMR_RDU);
 }
 
-/****************************************************************************
- ---------------------------- NIC START/CLOSE STUFF---------------------------
-*****************************************************************************/
+/* NIC START/CLOSE STUFF */
 static void _rtl92e_cancel_deferred_work(struct r8192_priv *priv)
 {
 	cancel_delayed_work_sync(&priv->watch_dog_wq);
@@ -2183,7 +2150,6 @@ static int _rtl92e_open(struct net_device *dev)
 	ret = _rtl92e_try_up(dev);
 	mutex_unlock(&priv->wx_mutex);
 	return ret;
-
 }
 
 static int _rtl92e_try_up(struct net_device *dev)
@@ -2195,32 +2161,25 @@ static int _rtl92e_try_up(struct net_device *dev)
 	return _rtl92e_up(dev, false);
 }
 
-
 static int _rtl92e_close(struct net_device *dev)
 {
 	struct r8192_priv *priv = rtllib_priv(dev);
 	int ret;
 
 	if ((rtllib_act_scanning(priv->rtllib, false)) &&
-		!(priv->rtllib->softmac_features & IEEE_SOFTMAC_SCAN)) {
+	    !(priv->rtllib->softmac_features & IEEE_SOFTMAC_SCAN)) {
 		rtllib_stop_scan(priv->rtllib);
 	}
-
 	mutex_lock(&priv->wx_mutex);
-
 	ret = _rtl92e_down(dev, true);
-
 	mutex_unlock(&priv->wx_mutex);
-
 	return ret;
-
 }
 
 static int _rtl92e_down(struct net_device *dev, bool shutdownrf)
 {
 	if (_rtl92e_sta_down(dev, shutdownrf) == -1)
 		return -1;
-
 	return 0;
 }
 
@@ -2243,9 +2202,7 @@ static void _rtl92e_restart(void *data)
 	struct net_device *dev = priv->rtllib->dev;
 
 	mutex_lock(&priv->wx_mutex);
-
 	rtl92e_commit(dev);
-
 	mutex_unlock(&priv->wx_mutex);
 }
 
@@ -2256,22 +2213,17 @@ static void _rtl92e_set_multicast(struct net_device *dev)
 
 	promisc = (dev->flags & IFF_PROMISC) ? 1 : 0;
 	priv->promisc = promisc;
-
 }
 
-
 static int _rtl92e_set_mac_adr(struct net_device *dev, void *mac)
 {
 	struct r8192_priv *priv = rtllib_priv(dev);
 	struct sockaddr *addr = mac;
 
 	mutex_lock(&priv->wx_mutex);
-
 	ether_addr_copy(dev->dev_addr, addr->sa_data);
-
 	schedule_work(&priv->reset_wq);
 	mutex_unlock(&priv->wx_mutex);
-
 	return 0;
 }
 
@@ -2283,7 +2235,8 @@ static int _rtl92e_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 	int ret = -1;
 	struct rtllib_device *ieee = priv->rtllib;
 	u32 key[4];
-	const u8 broadcast_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
+	const u8 broadcast_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff,
+									0xff};
 	struct iw_point *p = &wrq->u.data;
 	struct ieee_param *ipw = NULL;
 
@@ -2320,36 +2273,39 @@ static int _rtl92e_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 				}
 
 				if (ieee->pairwise_key_type) {
-					if (is_zero_ether_addr(ieee->ap_mac_addr))
+					if (is_zero_ether_addr(
+							ieee->ap_mac_addr))
 						ieee->iw_mode = IW_MODE_ADHOC;
 					memcpy((u8 *)key, ipw->u.crypt.key, 16);
 					rtl92e_enable_hw_security_config(dev);
 					rtl92e_set_swcam(dev, 4,
 							 ipw->u.crypt.idx,
-							 ieee->pairwise_key_type,
-							 (u8 *)ieee->ap_mac_addr,
-							 0, key, 0);
+							ieee->pairwise_key_type,
+							(u8 *)ieee->ap_mac_addr,
+								0, key, 0);
 					rtl92e_set_key(dev, 4, ipw->u.crypt.idx,
 						       ieee->pairwise_key_type,
 						       (u8 *)ieee->ap_mac_addr,
-						       0, key);
+								0, key);
 					if (ieee->iw_mode == IW_MODE_ADHOC) {
-						rtl92e_set_swcam(dev,
-								 ipw->u.crypt.idx,
-								 ipw->u.crypt.idx,
-								 ieee->pairwise_key_type,
-								 (u8 *)ieee->ap_mac_addr,
-								 0, key, 0);
-						rtl92e_set_key(dev,
-							       ipw->u.crypt.idx,
-							       ipw->u.crypt.idx,
-							       ieee->pairwise_key_type,
-							       (u8 *)ieee->ap_mac_addr,
-							       0, key);
+						rtl92e_set_swcam
+						(dev, ipw->u.crypt.idx,
+						 ipw->u.crypt.idx,
+						 ieee->pairwise_key_type,
+						 (u8 *)ieee->ap_mac_addr,
+							 0, key, 0);
+						rtl92e_set_key
+						(dev,
+						 ipw->u.crypt.idx,
+						 ipw->u.crypt.idx,
+						 ieee->pairwise_key_type,
+						 (u8 *)ieee->ap_mac_addr,
+								0, key);
 					}
 				}
-				if ((ieee->pairwise_key_type == KEY_TYPE_CCMP)
-				     && ieee->pHTInfo->bCurrentHTSupport) {
+				if ((ieee->pairwise_key_type ==
+				     KEY_TYPE_CCMP) &&
+				     ieee->pHTInfo->bCurrentHTSupport) {
 					rtl92e_writeb(dev, 0x173, 1);
 				}
 
@@ -2382,7 +2338,6 @@ static int _rtl92e_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 				}
 			}
 		}
-
 		ret = rtllib_wpa_supplicant_ioctl(priv->rtllib, &wrq->u.data,
 						  0);
 		kfree(ipw);
@@ -2394,11 +2349,9 @@ static int _rtl92e_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 
 out:
 	mutex_unlock(&priv->wx_mutex);
-
 	return ret;
 }
 
-
 static irqreturn_t _rtl92e_irq(int irq, void *netdev)
 {
 	struct net_device *dev = netdev;
@@ -2532,11 +2485,7 @@ static irqreturn_t _rtl92e_irq(int irq, void *netdev)
 	return IRQ_HANDLED;
 }
 
-
-
-/****************************************************************************
-	---------------------------- PCI_STUFF---------------------------
-*****************************************************************************/
+/* PCI_STUFF */
 static const struct net_device_ops rtl8192_netdev_ops = {
 	.ndo_open = _rtl92e_open,
 	.ndo_stop = _rtl92e_close,
@@ -2609,7 +2558,6 @@ static int _rtl92e_pci_probe(struct pci_dev *pdev,
 		goto err_rel_rtllib;
 	}
 
-
 	ioaddr = (unsigned long)ioremap_nocache(pmem_start, pmem_len);
 	if (ioaddr == (unsigned long)NULL) {
 		netdev_err(dev, "ioremap failed!");
@@ -2711,7 +2659,7 @@ static void _rtl92e_pci_disconnect(struct pci_dev *pdev)
 		if (dev->mem_start != 0) {
 			iounmap((void __iomem *)dev->mem_start);
 			release_mem_region(pci_resource_start(pdev, 1),
-					pci_resource_len(pdev, 1));
+					   pci_resource_len(pdev, 1));
 		}
 	} else {
 		priv = rtllib_priv(dev);
@@ -2726,7 +2674,7 @@ bool rtl92e_enable_nic(struct net_device *dev)
 	bool init_status = true;
 	struct r8192_priv *priv = rtllib_priv(dev);
 	struct rt_pwr_save_ctrl *pPSC = (struct rt_pwr_save_ctrl *)
-					(&(priv->rtllib->PowerSaveControl));
+					(&priv->rtllib->PowerSaveControl);
 
 	if (!priv->up) {
 		netdev_warn(dev, "%s(): Driver is already down!\n", __func__);
@@ -2751,6 +2699,7 @@ bool rtl92e_enable_nic(struct net_device *dev)
 	RT_TRACE(COMP_PS, "<===========%s()\n", __func__);
 	return init_status;
 }
+
 bool rtl92e_disable_nic(struct net_device *dev)
 {
 	struct r8192_priv *priv = rtllib_priv(dev);
@@ -2784,9 +2733,7 @@ void rtl92e_check_rfctrl_gpio_timer(unsigned long data)
 		  msecs_to_jiffies(RTLLIB_WATCH_DOG_TIME));
 }
 
-/***************************************************************************
-	------------------- module init / exit stubs ----------------
-****************************************************************************/
+/* module init / exit stubs */
 MODULE_DESCRIPTION("Linux driver for Realtek RTL819x WiFi cards");
 MODULE_AUTHOR(DRV_COPYRIGHT " " DRV_AUTHOR);
 MODULE_VERSION(DRV_VERSION);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 40+ messages in thread

* Re: [PATCH] staging: rtl8192e: fix coding style issue, improve error handling
  2017-03-07  7:09 [PATCH] staging: rtl8192e: fix coding style issue, improve error handling Suniel Mahesh
@ 2017-03-07 17:12 ` Dan Carpenter
  2017-03-09 18:50   ` [PATCH v2 0/5] staging: rtl8192e: Fix coding style, warnings and checks sunil.m
  2017-03-09 18:50 ` [PATCH] staging: rtl8192e: fix coding style issue, improve error handling kbuild test robot
  1 sibling, 1 reply; 40+ messages in thread
From: Dan Carpenter @ 2017-03-07 17:12 UTC (permalink / raw)
  To: Suniel Mahesh; +Cc: gregkh, devel, suniel.spartan, linux-kernel

On Tue, Mar 07, 2017 at 12:39:40PM +0530, Suniel Mahesh wrote:
> Fix coding style issue and comments in rtl_core.c
> Return -ENOMEM, if it is out of memory
> Pointer comparison with NULL replaced by logical NOT
> 

Split it up into 3 commits.

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PATCH] staging: rtl8192e: fix coding style issue, improve error handling
  2017-03-07  7:09 [PATCH] staging: rtl8192e: fix coding style issue, improve error handling Suniel Mahesh
  2017-03-07 17:12 ` Dan Carpenter
@ 2017-03-09 18:50 ` kbuild test robot
  1 sibling, 0 replies; 40+ messages in thread
From: kbuild test robot @ 2017-03-09 18:50 UTC (permalink / raw)
  To: Suniel Mahesh; +Cc: kbuild-all, gregkh, devel, linux-kernel, suniel.spartan

[-- Attachment #1: Type: text/plain, Size: 12575 bytes --]

Hi Suniel,

[auto build test ERROR on staging/staging-testing]
[also build test ERROR on v4.11-rc1 next-20170309]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Suniel-Mahesh/staging-rtl8192e-fix-coding-style-issue-improve-error-handling/20170310-015706
config: i386-randconfig-x076-201710 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All error/warnings (new ones prefixed by >>):

   drivers/staging/rtl8192e/rtl8192e/rtl_core.c: In function 'rtl92e_set_rf_state':
>> drivers/staging/rtl8192e/rtl8192e/rtl_core.c:220:13: error: 'WLAN_REASON_DISASSOC_STA_' undeclared (first use in this function)
                WLAN_REASON_DISASSOC_STA_
                ^~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/rtl8192e/rtl8192e/rtl_core.c:220:13: note: each undeclared identifier is reported only once for each function it appears in
>> drivers/staging/rtl8192e/rtl8192e/rtl_core.c:221:9: error: expected ')' before 'HAS_LEFT'
            HAS_LEFT);
            ^~~~~~~~
   drivers/staging/rtl8192e/rtl8192e/rtl_core.c: In function '_rtl92e_init_priv_variable':
>> drivers/staging/rtl8192e/rtl8192e/rtl_core.c:970:10: warning: 'return' with a value, in function returning void
      return -ENOMEM;
             ^
   drivers/staging/rtl8192e/rtl8192e/rtl_core.c:888:13: note: declared here
    static void _rtl92e_init_priv_variable(struct net_device *dev)
                ^~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/rtl8192e/rtl8192e/rtl_core.c: In function '_rtl92e_if_silent_reset':
>> drivers/staging/rtl8192e/rtl8192e/rtl_core.c:1247:24: warning: missing terminating " character
      RT_TRACE(COMP_RESET, "%s():======>start to down the
                           ^
   drivers/staging/rtl8192e/rtl8192e/rtl_core.c:1248:13: warning: missing terminating " character
        driver\n",  __func__);
                ^
   drivers/staging/rtl8192e/rtl8192e/rtl_core.c:1251:5: warning: missing terminating " character
        "%s():111111111111111111111111======>start to down the
        ^
   drivers/staging/rtl8192e/rtl8192e/rtl_core.c:1252:13: warning: missing terminating " character
        driver\n",  __func__);
                ^
>> drivers/staging/rtl8192e/rtl8192e/rtl_core.c:2751:0: error: unterminated argument list invoking macro "RT_TRACE"
    MODULE_PARM_DESC(channels, " Channel bitmask for specific locales. NYI");
    
>> drivers/staging/rtl8192e/rtl8192e/rtl_core.c:1247:3: error: 'RT_TRACE' undeclared (first use in this function)
      RT_TRACE(COMP_RESET, "%s():======>start to down the
      ^~~~~~~~
>> drivers/staging/rtl8192e/rtl8192e/rtl_core.c:1247:3: error: expected ';' at end of input
>> drivers/staging/rtl8192e/rtl8192e/rtl_core.c:1247:3: error: expected declaration or statement at end of input
>> drivers/staging/rtl8192e/rtl8192e/rtl_core.c:1247:3: error: expected declaration or statement at end of input
   drivers/staging/rtl8192e/rtl8192e/rtl_core.c:1232:1: warning: label 'RESET_START' defined but not used [-Wunused-label]
    RESET_START:
    ^~~~~~~~~~~
>> drivers/staging/rtl8192e/rtl8192e/rtl_core.c:1226:4: error: label 'END' used but not defined
       goto END;
       ^~~~
   drivers/staging/rtl8192e/rtl8192e/rtl_core.c:1217:24: warning: unused variable 'ieee' [-Wunused-variable]
     struct rtllib_device *ieee = priv->rtllib;
                           ^~~~
   drivers/staging/rtl8192e/rtl8192e/rtl_core.c:1216:6: warning: unused variable 'reset_status' [-Wunused-variable]
     int reset_status = 0;
         ^~~~~~~~~~~~
   drivers/staging/rtl8192e/rtl8192e/rtl_core.c:1215:5: warning: unused variable 'reset_times' [-Wunused-variable]
     u8 reset_times = 0;
        ^~~~~~~~~~~
   drivers/staging/rtl8192e/rtl8192e/rtl_core.c: At top level:
>> drivers/staging/rtl8192e/rtl8192e/rtl_core.c:71:12: warning: '_rtl92e_pci_probe' used but never defined
    static int _rtl92e_pci_probe(struct pci_dev *pdev,
               ^~~~~~~~~~~~~~~~~
>> drivers/staging/rtl8192e/rtl8192e/rtl_core.c:73:13: warning: '_rtl92e_pci_disconnect' used but never defined
    static void _rtl92e_pci_disconnect(struct pci_dev *pdev);
                ^~~~~~~~~~~~~~~~~~~~~~
>> drivers/staging/rtl8192e/rtl8192e/rtl_core.c:74:20: warning: '_rtl92e_irq' used but never defined
    static irqreturn_t _rtl92e_irq(int irq, void *netdev);
                       ^~~~~~~~~~~
>> drivers/staging/rtl8192e/rtl8192e/rtl_core.c:86:13: warning: '_rtl92e_watchdog_wq_cb' used but never defined
    static void _rtl92e_watchdog_wq_cb(void *data);
                ^~~~~~~~~~~~~~~~~~~~~~
>> drivers/staging/rtl8192e/rtl8192e/rtl_core.c:87:13: warning: '_rtl92e_watchdog_timer_cb' used but never defined
    static void _rtl92e_watchdog_timer_cb(unsigned long data);
                ^~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/staging/rtl8192e/rtl8192e/rtl_core.c:88:13: warning: '_rtl92e_hard_data_xmit' used but never defined
    static void _rtl92e_hard_data_xmit(struct sk_buff *skb, struct net_device *dev,
                ^~~~~~~~~~~~~~~~~~~~~~
>> drivers/staging/rtl8192e/rtl8192e/rtl_core.c:90:12: warning: '_rtl92e_hard_start_xmit' used but never defined
    static int _rtl92e_hard_start_xmit(struct sk_buff *skb, struct net_device *dev);
               ^~~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/rtl8192e/rtl8192e/rtl_core.c:91:13: warning: '_rtl92e_tx_cmd' declared 'static' but never defined [-Wunused-function]
    static void _rtl92e_tx_cmd(struct net_device *dev, struct sk_buff *skb);
                ^~~~~~~~~~~~~~
   drivers/staging/rtl8192e/rtl8192e/rtl_core.c:92:14: warning: '_rtl92e_tx' declared 'static' but never defined [-Wunused-function]
    static short _rtl92e_tx(struct net_device *dev, struct sk_buff *skb);
                 ^~~~~~~~~~
>> drivers/staging/rtl8192e/rtl8192e/rtl_core.c:93:14: warning: '_rtl92e_pci_initdescring' used but never defined
    static short _rtl92e_pci_initdescring(struct net_device *dev);
                 ^~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/staging/rtl8192e/rtl8192e/rtl_core.c:94:13: warning: '_rtl92e_irq_tx_tasklet' used but never defined
    static void _rtl92e_irq_tx_tasklet(struct r8192_priv *priv);
                ^~~~~~~~~~~~~~~~~~~~~~
>> drivers/staging/rtl8192e/rtl8192e/rtl_core.c:95:13: warning: '_rtl92e_irq_rx_tasklet' used but never defined
    static void _rtl92e_irq_rx_tasklet(struct r8192_priv *priv);
                ^~~~~~~~~~~~~~~~~~~~~~

vim +/WLAN_REASON_DISASSOC_STA_ +220 drivers/staging/rtl8192e/rtl8192e/rtl_core.c

    65		{RTL_PCI_DEVICE(0x07aa, 0x0047, rtl819xp_ops)},
    66		{}
    67	};
    68	
    69	MODULE_DEVICE_TABLE(pci, rtl8192_pci_id_tbl);
    70	
  > 71	static int _rtl92e_pci_probe(struct pci_dev *pdev,
    72				     const struct pci_device_id *id);
  > 73	static void _rtl92e_pci_disconnect(struct pci_dev *pdev);
  > 74	static irqreturn_t _rtl92e_irq(int irq, void *netdev);
    75	
    76	static struct pci_driver rtl8192_pci_driver = {
    77		.name = DRV_NAME,	/* Driver name   */
    78		.id_table = rtl8192_pci_id_tbl,	/* PCI_ID table  */
    79		.probe	= _rtl92e_pci_probe,	/* probe fn      */
    80		.remove	 = _rtl92e_pci_disconnect,	/* remove fn */
    81		.suspend = rtl92e_suspend,	/* PM suspend fn */
    82		.resume = rtl92e_resume,                 /* PM resume fn  */
    83	};
    84	
    85	static short _rtl92e_is_tx_queue_empty(struct net_device *dev);
  > 86	static void _rtl92e_watchdog_wq_cb(void *data);
  > 87	static void _rtl92e_watchdog_timer_cb(unsigned long data);
  > 88	static void _rtl92e_hard_data_xmit(struct sk_buff *skb, struct net_device *dev,
    89					   int rate);
  > 90	static int _rtl92e_hard_start_xmit(struct sk_buff *skb, struct net_device *dev);
  > 91	static void _rtl92e_tx_cmd(struct net_device *dev, struct sk_buff *skb);
  > 92	static short _rtl92e_tx(struct net_device *dev, struct sk_buff *skb);
  > 93	static short _rtl92e_pci_initdescring(struct net_device *dev);
  > 94	static void _rtl92e_irq_tx_tasklet(struct r8192_priv *priv);
  > 95	static void _rtl92e_irq_rx_tasklet(struct r8192_priv *priv);
  > 96	static void _rtl92e_cancel_deferred_work(struct r8192_priv *priv);
  > 97	static int _rtl92e_up(struct net_device *dev, bool is_silent_reset);
    98	static int _rtl92e_try_up(struct net_device *dev);
    99	static int _rtl92e_down(struct net_device *dev, bool shutdownrf);
 > 100	static void _rtl92e_restart(void *data);
   101	
   102	/* IO STUFF */
   103	
   104	u8 rtl92e_readb(struct net_device *dev, int x)
   105	{
   106		return 0xff & readb((u8 __iomem *)dev->mem_start + x);
   107	}
   108	
   109	u32 rtl92e_readl(struct net_device *dev, int x)
   110	{
   111		return readl((u8 __iomem *)dev->mem_start + x);
   112	}
   113	
   114	u16 rtl92e_readw(struct net_device *dev, int x)
   115	{
   116		return readw((u8 __iomem *)dev->mem_start + x);
   117	}
   118	
   119	void rtl92e_writeb(struct net_device *dev, int x, u8 y)
   120	{
   121		writeb(y, (u8 __iomem *)dev->mem_start + x);
   122	
   123		udelay(20);
   124	}
   125	
   126	void rtl92e_writel(struct net_device *dev, int x, u32 y)
   127	{
   128		writel(y, (u8 __iomem *)dev->mem_start + x);
   129	
   130		udelay(20);
   131	}
   132	
   133	void rtl92e_writew(struct net_device *dev, int x, u16 y)
   134	{
   135		writew(y, (u8 __iomem *)dev->mem_start + x);
   136	
   137		udelay(20);
   138	}
   139	
   140	/* GENERAL FUNCTION */
   141	bool rtl92e_set_rf_state(struct net_device *dev,
   142				 enum rt_rf_power_state StateToSet,
   143				 RT_RF_CHANGE_SOURCE ChangeSource)
   144	{
   145		struct r8192_priv *priv = rtllib_priv(dev);
   146		struct rtllib_device *ieee = priv->rtllib;
   147		bool			bActionAllowed = false;
   148		bool			bConnectBySSID = false;
   149		enum rt_rf_power_state rtState;
   150		u16			RFWaitCounter = 0;
   151		unsigned long flag;
   152	
   153		RT_TRACE((COMP_PS | COMP_RF),
   154			 "===>rtl92e_set_rf_state(): StateToSet(%d)\n", StateToSet);
   155	
   156		while (true) {
   157			spin_lock_irqsave(&priv->rf_ps_lock, flag);
   158			if (priv->RFChangeInProgress) {
   159				spin_unlock_irqrestore(&priv->rf_ps_lock, flag);
   160				RT_TRACE((COMP_PS | COMP_RF),
   161					 "rtl92e_set_rf_state(): RF Change in progress! Wait to set..StateToSet(%d).\n",
   162					 StateToSet);
   163	
   164				while (priv->RFChangeInProgress) {
   165					RFWaitCounter++;
   166					RT_TRACE((COMP_PS | COMP_RF),
   167						 "rtl92e_set_rf_state(): Wait 1 ms (%d times)...\n",
   168						 RFWaitCounter);
   169					mdelay(1);
   170	
   171					if (RFWaitCounter > 100) {
   172						netdev_warn(dev,
   173							    "%s(): Timeout waiting for RF change.\n",
   174							    __func__);
   175						return false;
   176					}
   177				}
   178			} else {
   179				priv->RFChangeInProgress = true;
   180				spin_unlock_irqrestore(&priv->rf_ps_lock, flag);
   181				break;
   182			}
   183		}
   184	
   185		rtState = priv->rtllib->eRFPowerState;
   186	
   187		switch (StateToSet) {
   188		case eRfOn:
   189			priv->rtllib->RfOffReason &= (~ChangeSource);
   190	
   191			if ((ChangeSource == RF_CHANGE_BY_HW) && priv->bHwRadioOff)
   192				priv->bHwRadioOff = false;
   193	
   194			if (!priv->rtllib->RfOffReason) {
   195				priv->rtllib->RfOffReason = 0;
   196				bActionAllowed = true;
   197	
   198				if (rtState == eRfOff &&
   199				    ChangeSource >= RF_CHANGE_BY_HW)
   200					bConnectBySSID = true;
   201			} else {
   202				RT_TRACE((COMP_PS | COMP_RF),
   203					 "rtl92e_set_rf_state - eRfon reject pMgntInfo->RfOffReason= 0x%x, ChangeSource=0x%X\n",
   204					  priv->rtllib->RfOffReason, ChangeSource);
   205		}
   206	
   207			break;
   208	
   209		case eRfOff:
   210	
   211			if ((priv->rtllib->iw_mode == IW_MODE_INFRA) ||
   212			    (priv->rtllib->iw_mode == IW_MODE_ADHOC)) {
   213				if ((priv->rtllib->RfOffReason > RF_CHANGE_BY_IPS) ||
   214				    (ChangeSource > RF_CHANGE_BY_IPS)) {
   215					if (ieee->state == RTLLIB_LINKED)
   216						priv->blinked_ingpio = true;
   217					else
   218						priv->blinked_ingpio = false;
   219					rtllib_MgntDisconnect(priv->rtllib,
 > 220							      WLAN_REASON_DISASSOC_STA_
 > 221									HAS_LEFT);
   222				}
   223			}
   224			if ((ChangeSource == RF_CHANGE_BY_HW) && !priv->bHwRadioOff)

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 33920 bytes --]

^ permalink raw reply	[flat|nested] 40+ messages in thread

* [PATCH v2 0/5] staging: rtl8192e: Fix coding style, warnings and checks
  2017-03-07 17:12 ` Dan Carpenter
@ 2017-03-09 18:50   ` sunil.m
  2017-03-09 18:50     ` [PATCH v2 1/5] staging: rtl8192e: Fix coding style issues sunil.m
                       ` (4 more replies)
  0 siblings, 5 replies; 40+ messages in thread
From: sunil.m @ 2017-03-09 18:50 UTC (permalink / raw)
  To: gregkh, dan.carpenter; +Cc: devel, linux-kernel, suniel.spartan, Suniel Mahesh

From: Suniel Mahesh <sunil.m@techveda.org>

Fixed coding style issues and improved error handling, return -ENOMEM, if 
it is out of memory instead of err message. Pointer comparisions with NUll 
are replaced by logical NOT. Fixed unbalanced braces around else statement
and preferred to pass a pointer as an argument to sizeof() instead of
struct definition.

Rebased on top of next-20170306.

Suniel Mahesh (5):
  staging: rtl8192e: Fix coding style issues
  staging: rtl8192e: Improve error handling
  staging: rtl8192e: Rectify pointer comparisions
  staging: rtl8192e: Fix unbalanced braces around else statement
  staging: rtl8192e: Pass a pointer as an argument to sizeof() instead
    of struct

 drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 274 +++++++++++----------------
 1 file changed, 112 insertions(+), 162 deletions(-)

-- 
1.9.1

^ permalink raw reply	[flat|nested] 40+ messages in thread

* [PATCH v2 1/5] staging: rtl8192e: Fix coding style issues
  2017-03-09 18:50   ` [PATCH v2 0/5] staging: rtl8192e: Fix coding style, warnings and checks sunil.m
@ 2017-03-09 18:50     ` sunil.m
  2017-03-11  8:11       ` kbuild test robot
  2017-03-12 13:41       ` Greg KH
  2017-03-09 18:50     ` [PATCH v2 2/5] staging: rtl8192e: Improve error handling sunil.m
                       ` (3 subsequent siblings)
  4 siblings, 2 replies; 40+ messages in thread
From: sunil.m @ 2017-03-09 18:50 UTC (permalink / raw)
  To: gregkh, dan.carpenter; +Cc: devel, linux-kernel, suniel.spartan, Suniel Mahesh

From: Suniel Mahesh <sunil.m@techveda.org>

Fix coding style issues and comments in rtl_core.c

Signed-off-by: Suniel Mahesh <sunil.m@techveda.org>
---
Changes for v2:

- Split larger patch into multiple commits as suggested by Dan Carpenter
- This patch fixes coding style issues, comments in rtl_core.c reported by checkpatch.pl
- Modified short description to 'Fix coding style issues' from 'Fix coding style issues,
  improve error handling'
- Improve error handling is taken care by the following patch in the series
- Removed statements, 'Return -ENOMEM, if it is out of memory', 'Pointer comparison with
  NULL replaced by logical NOT' from the body of the patch
- Rebased on top of next-20170306
---
 drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 248 +++++++++++----------------
 1 file changed, 98 insertions(+), 150 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
index 4c0caa6..349c49b 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
@@ -1,4 +1,4 @@
-/******************************************************************************
+/************************************************************************
  * Copyright(c) 2008 - 2010 Realtek Corporation. All rights reserved.
  *
  * Based on the r8180 driver, which is:
@@ -17,7 +17,7 @@
  *
  * Contact Information:
  * wlanfae <wlanfae@realtek.com>
-******************************************************************************/
+ *************************************************************************/
 #include <linux/uaccess.h>
 #include <linux/pci.h>
 #include <linux/vmalloc.h>
@@ -37,7 +37,6 @@
 static int channels = 0x3fff;
 static char *ifname = "wlan%d";
 
-
 static const struct rtl819x_ops rtl819xp_ops = {
 	.nic_type			= NIC_8192E,
 	.get_eeprom_size		= rtl92e_get_eeprom_size,
@@ -100,9 +99,7 @@ static void _rtl92e_hard_data_xmit(struct sk_buff *skb, struct net_device *dev,
 static int _rtl92e_down(struct net_device *dev, bool shutdownrf);
 static void _rtl92e_restart(void *data);
 
-/****************************************************************************
-   -----------------------------IO STUFF-------------------------
-*****************************************************************************/
+/* IO STUFF */
 
 u8 rtl92e_readb(struct net_device *dev, int x)
 {
@@ -140,9 +137,7 @@ void rtl92e_writew(struct net_device *dev, int x, u16 y)
 	udelay(20);
 }
 
-/****************************************************************************
-   -----------------------------GENERAL FUNCTION-------------------------
-*****************************************************************************/
+/* GENERAL FUNCTION */
 bool rtl92e_set_rf_state(struct net_device *dev,
 			 enum rt_rf_power_state StateToSet,
 			 RT_RF_CHANGE_SOURCE ChangeSource)
@@ -200,7 +195,6 @@ bool rtl92e_set_rf_state(struct net_device *dev,
 			priv->rtllib->RfOffReason = 0;
 			bActionAllowed = true;
 
-
 			if (rtState == eRfOff &&
 			    ChangeSource >= RF_CHANGE_BY_HW)
 				bConnectBySSID = true;
@@ -223,7 +217,8 @@ bool rtl92e_set_rf_state(struct net_device *dev,
 				else
 					priv->blinked_ingpio = false;
 				rtllib_MgntDisconnect(priv->rtllib,
-						      WLAN_REASON_DISASSOC_STA_HAS_LEFT);
+						      WLAN_REASON_DISASSOC_STA_
+								HAS_LEFT);
 			}
 		}
 		if ((ChangeSource == RF_CHANGE_BY_HW) && !priv->bHwRadioOff)
@@ -247,7 +242,6 @@ bool rtl92e_set_rf_state(struct net_device *dev,
 			 StateToSet, priv->rtllib->RfOffReason);
 		PHY_SetRFPowerState(dev, StateToSet);
 		if (StateToSet == eRfOn) {
-
 			if (bConnectBySSID && priv->blinked_ingpio) {
 				schedule_delayed_work(
 					 &ieee->associate_procedure_wq, 0);
@@ -346,16 +340,16 @@ static void _rtl92e_update_cap(struct net_device *dev, u16 cap)
 		}
 	}
 
-	if (net->mode & (IEEE_G|IEEE_N_24G)) {
+	if (net->mode & (IEEE_G | IEEE_N_24G)) {
 		u8	slot_time_val;
 		u8	CurSlotTime = priv->slot_time;
 
 		if ((cap & WLAN_CAPABILITY_SHORT_SLOT_TIME) &&
-		   (!priv->rtllib->pHTInfo->bCurrentRT2RTLongSlotTime)) {
+		    (!priv->rtllib->pHTInfo->bCurrentRT2RTLongSlotTime)) {
 			if (CurSlotTime != SHORT_SLOT_TIME) {
 				slot_time_val = SHORT_SLOT_TIME;
 				priv->rtllib->SetHwRegHandler(dev,
-					 HW_VAR_SLOT_TIME, &slot_time_val);
+				HW_VAR_SLOT_TIME, &slot_time_val);
 			}
 		} else {
 			if (CurSlotTime != NON_SHORT_SLOT_TIME) {
@@ -407,7 +401,6 @@ static void _rtl92e_qos_activate(void *data)
 	for (i = 0; i <  QOS_QUEUE_NUM; i++)
 		priv->rtllib->SetHwRegHandler(dev, HW_VAR_AC_PARAM, (u8 *)(&i));
 
-
 success:
 	mutex_unlock(&priv->mutex);
 }
@@ -427,16 +420,16 @@ static int _rtl92e_qos_handle_probe_response(struct r8192_priv *priv,
 
 	if (network->flags & NETWORK_HAS_QOS_MASK) {
 		if (active_network &&
-				(network->flags & NETWORK_HAS_QOS_PARAMETERS))
+		    (network->flags & NETWORK_HAS_QOS_PARAMETERS))
 			network->qos_data.active = network->qos_data.supported;
 
 		if ((network->qos_data.active == 1) && (active_network == 1) &&
-				(network->flags & NETWORK_HAS_QOS_PARAMETERS) &&
-				(network->qos_data.old_param_count !=
-				network->qos_data.param_count)) {
+		    (network->flags & NETWORK_HAS_QOS_PARAMETERS) &&
+		     (network->qos_data.old_param_count !=
+			network->qos_data.param_count)) {
 			network->qos_data.old_param_count =
 				network->qos_data.param_count;
-	priv->rtllib->wmm_acm = network->qos_data.wmm_acm;
+			priv->rtllib->wmm_acm = network->qos_data.wmm_acm;
 			schedule_work(&priv->qos_activate);
 			RT_TRACE(COMP_QOS,
 				 "QoS parameters change call qos_activate\n");
@@ -467,7 +460,6 @@ static int _rtl92e_handle_beacon(struct net_device *dev,
 
 	schedule_delayed_work(&priv->update_beacon_wq, 0);
 	return 0;
-
 }
 
 static int _rtl92e_qos_assoc_resp(struct r8192_priv *priv,
@@ -500,7 +492,7 @@ static int _rtl92e_qos_assoc_resp(struct r8192_priv *priv,
 			network->qos_data.param_count;
 	} else {
 		memcpy(&priv->rtllib->current_network.qos_data.parameters,
-		&def_qos_parameters, size);
+		       &def_qos_parameters, size);
 		priv->rtllib->current_network.qos_data.active = 0;
 		priv->rtllib->current_network.qos_data.supported = 0;
 		set_qos_param = 1;
@@ -518,8 +510,8 @@ static int _rtl92e_qos_assoc_resp(struct r8192_priv *priv,
 }
 
 static int _rtl92e_handle_assoc_response(struct net_device *dev,
-				 struct rtllib_assoc_response_frame *resp,
-				 struct rtllib_network *network)
+					 struct rtllib_assoc_response_frame
+					 *resp, struct rtllib_network *network)
 {
 	struct r8192_priv *priv = rtllib_priv(dev);
 
@@ -680,7 +672,7 @@ static u8 _rtl92e_get_supported_wireless_mode(struct net_device *dev)
 	case RF_8256:
 	case RF_6052:
 	case RF_PSEUDO_11N:
-		ret = (WIRELESS_MODE_N_24G|WIRELESS_MODE_G | WIRELESS_MODE_B);
+		ret = (WIRELESS_MODE_N_24G | WIRELESS_MODE_G | WIRELESS_MODE_B);
 		break;
 	case RF_8258:
 		ret = (WIRELESS_MODE_A | WIRELESS_MODE_N_5G);
@@ -742,7 +734,7 @@ static int _rtl92e_sta_up(struct net_device *dev, bool is_silent_reset)
 {
 	struct r8192_priv *priv = rtllib_priv(dev);
 	struct rt_pwr_save_ctrl *pPSC = (struct rt_pwr_save_ctrl *)
-					(&(priv->rtllib->PowerSaveControl));
+					&priv->rtllib->PowerSaveControl;
 	bool init_status = true;
 
 	priv->bDriverIsGoingToUnload = false;
@@ -888,12 +880,11 @@ static void _rtl92e_init_priv_constant(struct net_device *dev)
 {
 	struct r8192_priv *priv = rtllib_priv(dev);
 	struct rt_pwr_save_ctrl *pPSC = (struct rt_pwr_save_ctrl *)
-					&(priv->rtllib->PowerSaveControl);
+					&priv->rtllib->PowerSaveControl;
 
 	pPSC->RegMaxLPSAwakeIntvl = 5;
 }
 
-
 static void _rtl92e_init_priv_variable(struct net_device *dev)
 {
 	struct r8192_priv *priv = rtllib_priv(dev);
@@ -978,7 +969,6 @@ static void _rtl92e_init_priv_variable(struct net_device *dev)
 	if (!priv->pFirmware)
 		netdev_err(dev,
 			   "rtl8192e: Unable to allocate space for firmware\n");
-
 	skb_queue_head_init(&priv->skb_queue);
 
 	for (i = 0; i < MAX_QUEUE_SIZE; i++)
@@ -1015,9 +1005,9 @@ static void _rtl92e_init_priv_task(struct net_device *dev)
 			      (void *)_rtl92e_update_beacon, dev);
 	INIT_WORK_RSL(&priv->qos_activate, (void *)_rtl92e_qos_activate, dev);
 	INIT_DELAYED_WORK_RSL(&priv->rtllib->hw_wakeup_wq,
-			      (void *) rtl92e_hw_wakeup_wq, dev);
+			      (void *)rtl92e_hw_wakeup_wq, dev);
 	INIT_DELAYED_WORK_RSL(&priv->rtllib->hw_sleep_wq,
-			      (void *) rtl92e_hw_sleep_wq, dev);
+			      (void *)rtl92e_hw_sleep_wq, dev);
 	tasklet_init(&priv->irq_rx_tasklet,
 		     (void(*)(unsigned long))_rtl92e_irq_rx_tasklet,
 		     (unsigned long)priv);
@@ -1035,8 +1025,8 @@ static short _rtl92e_get_channel_map(struct net_device *dev)
 
 	struct r8192_priv *priv = rtllib_priv(dev);
 
-	if ((priv->rf_chip != RF_8225) && (priv->rf_chip != RF_8256)
-			&& (priv->rf_chip != RF_6052)) {
+	if ((priv->rf_chip != RF_8225) && (priv->rf_chip != RF_8256) &&
+	    (priv->rf_chip != RF_6052)) {
 		netdev_err(dev, "%s: unknown rf chip, can't set channel map\n",
 			   __func__);
 		return -1;
@@ -1062,7 +1052,7 @@ static short _rtl92e_init(struct net_device *dev)
 {
 	struct r8192_priv *priv = rtllib_priv(dev);
 
-	memset(&(priv->stats), 0, sizeof(struct rt_stats));
+	memset(&priv->stats, 0, sizeof(struct rt_stats));
 
 	_rtl92e_init_priv_handler(dev);
 	_rtl92e_init_priv_constant(dev);
@@ -1077,7 +1067,7 @@ static short _rtl92e_init(struct net_device *dev)
 
 	setup_timer(&priv->watch_dog_timer,
 		    _rtl92e_watchdog_timer_cb,
-		    (unsigned long) dev);
+		    (unsigned long)dev);
 
 	setup_timer(&priv->gpio_polling_timer,
 		    rtl92e_check_rfctrl_gpio_timer,
@@ -1101,9 +1091,7 @@ static short _rtl92e_init(struct net_device *dev)
 	return 0;
 }
 
-/***************************************************************************
-	-------------------------------WATCHDOG STUFF---------------------------
-***************************************************************************/
+/* WATCHDOG STUFF */
 static short _rtl92e_is_tx_queue_empty(struct net_device *dev)
 {
 	int i = 0;
@@ -1114,7 +1102,8 @@ static short _rtl92e_is_tx_queue_empty(struct net_device *dev)
 			continue;
 		if (skb_queue_len(&(&priv->tx_ring[i])->queue) > 0) {
 			netdev_info(dev, "===>tx queue is not empty:%d, %d\n",
-			       i, skb_queue_len(&(&priv->tx_ring[i])->queue));
+				    i,
+				    skb_queue_len(&(&priv->tx_ring[i])->queue));
 			return 0;
 		}
 	}
@@ -1134,7 +1123,7 @@ static enum reset_type _rtl92e_tx_check_stuck(struct net_device *dev)
 	switch (priv->rtllib->ps) {
 	case RTLLIB_PS_DISABLED:
 		break;
-	case (RTLLIB_PS_MBCAST|RTLLIB_PS_UNICAST):
+	case (RTLLIB_PS_MBCAST | RTLLIB_PS_UNICAST):
 		break;
 	default:
 		break;
@@ -1219,7 +1208,6 @@ static enum reset_type _rtl92e_if_check_reset(struct net_device *dev)
 	} else {
 		return RESET_TYPE_NORESET;
 	}
-
 }
 
 static void _rtl92e_if_silent_reset(struct net_device *dev)
@@ -1231,11 +1219,8 @@ static void _rtl92e_if_silent_reset(struct net_device *dev)
 	unsigned long flag;
 
 	if (priv->ResetProgress == RESET_TYPE_NORESET) {
-
 		RT_TRACE(COMP_RESET, "=========>Reset progress!!\n");
-
 		priv->ResetProgress = RESET_TYPE_SILENT;
-
 		spin_lock_irqsave(&priv->rf_ps_lock, flag);
 		if (priv->RFChangeInProgress) {
 			spin_unlock_irqrestore(&priv->rf_ps_lock, flag);
@@ -1260,16 +1245,14 @@ static void _rtl92e_if_silent_reset(struct net_device *dev)
 		}
 		priv->up = 0;
 
-		RT_TRACE(COMP_RESET, "%s():======>start to down the driver\n",
-			  __func__);
+		RT_TRACE(COMP_RESET, "%s():======>start to down the
+			 driver\n",  __func__);
 		mdelay(1000);
 		RT_TRACE(COMP_RESET,
-			 "%s():111111111111111111111111======>start to down the driver\n",
-			 __func__);
-
+			 "%s():111111111111111111111111======>start to down the
+			 driver\n",  __func__);
 		if (!netif_queue_stopped(dev))
 			netif_stop_queue(dev);
-
 		rtl92e_irq_disable(dev);
 		del_timer_sync(&priv->watch_dog_timer);
 		_rtl92e_cancel_deferred_work(priv);
@@ -1387,7 +1370,7 @@ static void _rtl92e_watchdog_wq_cb(void *data)
 	static u8 check_reset_cnt;
 	unsigned long flags;
 	struct rt_pwr_save_ctrl *pPSC = (struct rt_pwr_save_ctrl *)
-					(&(priv->rtllib->PowerSaveControl));
+					 &priv->rtllib->PowerSaveControl;
 	bool bBusyTraffic = false;
 	bool	bHigherBusyTraffic = false;
 	bool	bHigherBusyRxTraffic = false;
@@ -1422,10 +1405,9 @@ static void _rtl92e_watchdog_wq_cb(void *data)
 	if ((ieee->state == RTLLIB_LINKED) && (ieee->iw_mode ==
 	     IW_MODE_INFRA) && (!ieee->bNetPromiscuousMode)) {
 		if (ieee->LinkDetectInfo.NumRxOkInPeriod > 100 ||
-		ieee->LinkDetectInfo.NumTxOkInPeriod > 100)
+		    ieee->LinkDetectInfo.NumTxOkInPeriod > 100)
 			bBusyTraffic = true;
 
-
 		if (ieee->LinkDetectInfo.NumRxOkInPeriod > 4000 ||
 		    ieee->LinkDetectInfo.NumTxOkInPeriod > 4000) {
 			bHigherBusyTraffic = true;
@@ -1469,12 +1451,11 @@ static void _rtl92e_watchdog_wq_cb(void *data)
 
 		_rtl92e_update_rxcounts(priv, &TotalRxBcnNum, &TotalRxDataNum);
 
-		if ((TotalRxBcnNum+TotalRxDataNum) == 0)
+		if ((TotalRxBcnNum + TotalRxDataNum) == 0)
 			priv->check_roaming_cnt++;
 		else
 			priv->check_roaming_cnt = 0;
 
-
 		if (priv->check_roaming_cnt > 0) {
 			if (ieee->eRFPowerState == eRfOff)
 				netdev_info(dev, "%s(): RF is off\n", __func__);
@@ -1493,11 +1474,10 @@ static void _rtl92e_watchdog_wq_cb(void *data)
 			if (ieee->LedControlHandler)
 				ieee->LedControlHandler(ieee->dev,
 							LED_CTL_START_TO_LINK);
-
 			notify_wx_assoc_event(ieee);
 
 			if (!(ieee->rtllib_ap_sec_type(ieee) &
-			     (SEC_ALG_CCMP|SEC_ALG_TKIP)))
+			     (SEC_ALG_CCMP | SEC_ALG_TKIP)))
 				schedule_delayed_work(
 					&ieee->associate_procedure_wq, 0);
 
@@ -1505,9 +1485,7 @@ static void _rtl92e_watchdog_wq_cb(void *data)
 		}
 		ieee->LinkDetectInfo.NumRecvBcnInPeriod = 0;
 		ieee->LinkDetectInfo.NumRecvDataInPeriod = 0;
-
 	}
-
 	spin_lock_irqsave(&priv->tx_lock, flags);
 	if ((check_reset_cnt++ >= 3) && (!ieee->is_roaming) &&
 	    (!priv->RFChangeInProgress) && (!pPSC->bSwRfProcessing)) {
@@ -1523,7 +1501,7 @@ static void _rtl92e_watchdog_wq_cb(void *data)
 	}
 
 	if (((priv->force_reset) || (!priv->bDisableNormalResetCheck &&
-	      ResetType == RESET_TYPE_SILENT)))
+				     ResetType == RESET_TYPE_SILENT)))
 		_rtl92e_if_silent_reset(dev);
 	priv->force_reset = false;
 	priv->bForcedSilentReset = false;
@@ -1540,9 +1518,7 @@ static void _rtl92e_watchdog_timer_cb(unsigned long data)
 		  msecs_to_jiffies(RTLLIB_WATCH_DOG_TIME));
 }
 
-/****************************************************************************
- ---------------------------- NIC TX/RX STUFF---------------------------
-*****************************************************************************/
+/* NIC TX/RX STUFF */
 void rtl92e_rx_enable(struct net_device *dev)
 {
 	struct r8192_priv *priv = rtllib_priv(dev);
@@ -1559,7 +1535,6 @@ void rtl92e_tx_enable(struct net_device *dev)
 	rtllib_reset_queue(priv->rtllib);
 }
 
-
 static void _rtl92e_free_rx_ring(struct net_device *dev)
 {
 	struct r8192_priv *priv = rtllib_priv(dev);
@@ -1573,17 +1548,16 @@ static void _rtl92e_free_rx_ring(struct net_device *dev)
 			if (!skb)
 				continue;
 
-			pci_unmap_single(priv->pdev,
-				*((dma_addr_t *)skb->cb),
-				priv->rxbuffersize, PCI_DMA_FROMDEVICE);
+			pci_unmap_single(priv->pdev, *((dma_addr_t *)skb->cb),
+					 priv->rxbuffersize,
+					 PCI_DMA_FROMDEVICE);
 				kfree_skb(skb);
 		}
-
 		pci_free_consistent(priv->pdev,
-			sizeof(*priv->rx_ring[rx_queue_idx]) *
-			priv->rxringcount,
-			priv->rx_ring[rx_queue_idx],
-			priv->rx_ring_dma[rx_queue_idx]);
+				    sizeof(*priv->rx_ring[rx_queue_idx]) *
+				    priv->rxringcount,
+				    priv->rx_ring[rx_queue_idx],
+				    priv->rx_ring_dma[rx_queue_idx]);
 		priv->rx_ring[rx_queue_idx] = NULL;
 	}
 }
@@ -1598,13 +1572,13 @@ static void _rtl92e_free_tx_ring(struct net_device *dev, unsigned int prio)
 		struct sk_buff *skb = __skb_dequeue(&ring->queue);
 
 		pci_unmap_single(priv->pdev, entry->TxBuffAddr,
-			skb->len, PCI_DMA_TODEVICE);
+				 skb->len, PCI_DMA_TODEVICE);
 		kfree_skb(skb);
 		ring->idx = (ring->idx + 1) % ring->entries;
 	}
 
-	pci_free_consistent(priv->pdev, sizeof(*ring->desc)*ring->entries,
-	ring->desc, ring->dma);
+	pci_free_consistent(priv->pdev, sizeof(*ring->desc) * ring->entries,
+			    ring->desc, ring->dma);
 	ring->desc = NULL;
 }
 
@@ -1618,7 +1592,7 @@ static void _rtl92e_hard_data_xmit(struct sk_buff *skb, struct net_device *dev,
 	u8 queue_index = tcb_desc->queue_index;
 
 	if ((priv->rtllib->eRFPowerState == eRfOff) || !priv->up ||
-	     priv->bResetInProgress) {
+	    priv->bResetInProgress) {
 		kfree_skb(skb);
 		return;
 	}
@@ -1650,7 +1624,7 @@ static int _rtl92e_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
 
 	if (queue_index != TXCMD_QUEUE) {
 		if ((priv->rtllib->eRFPowerState == eRfOff) ||
-		     !priv->up || priv->bResetInProgress) {
+		    !priv->up || priv->bResetInProgress) {
 			kfree_skb(skb);
 			return 0;
 		}
@@ -1691,8 +1665,7 @@ static void _rtl92e_tx_isr(struct net_device *dev, int prio)
 
 		skb = __skb_dequeue(&ring->queue);
 		pci_unmap_single(priv->pdev, entry->TxBuffAddr,
-		skb->len, PCI_DMA_TODEVICE);
-
+				 skb->len, PCI_DMA_TODEVICE);
 		kfree_skb(skb);
 	}
 	if (prio != BEACON_QUEUE)
@@ -1712,7 +1685,7 @@ static void _rtl92e_tx_cmd(struct net_device *dev, struct sk_buff *skb)
 	ring = &priv->tx_ring[TXCMD_QUEUE];
 
 	idx = (ring->idx + skb_queue_len(&ring->queue)) % ring->entries;
-	entry = (struct tx_desc_cmd *) &ring->desc[idx];
+	entry = (struct tx_desc_cmd *)&ring->desc[idx];
 
 	tcb_desc = (struct cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE);
 
@@ -1806,7 +1779,8 @@ static short _rtl92e_alloc_rx_ring(struct net_device *dev)
 
 	for (rx_queue_idx = 0; rx_queue_idx < MAX_RX_QUEUE; rx_queue_idx++) {
 		priv->rx_ring[rx_queue_idx] = pci_zalloc_consistent(priv->pdev,
-					      sizeof(*priv->rx_ring[rx_queue_idx]) * priv->rxringcount,
+					      sizeof(*priv->rx_ring[
+					rx_queue_idx]) * priv->rxringcount,
 					      &priv->rx_ring_dma[rx_queue_idx]);
 		if (!priv->rx_ring[rx_queue_idx] ||
 		    (unsigned long)priv->rx_ring[rx_queue_idx] & 0xFF) {
@@ -1961,13 +1935,11 @@ long rtl92e_translate_to_dbm(struct r8192_priv *priv, u8 signal_strength_index)
 	return signal_power;
 }
 
-
 void rtl92e_update_rx_statistics(struct r8192_priv *priv,
 				 struct rtllib_rx_stats *pprevious_stats)
 {
 	int weighting = 0;
 
-
 	if (priv->stats.recv_signal_power == 0)
 		priv->stats.recv_signal_power =
 					 pprevious_stats->RecvSignalPower;
@@ -2017,8 +1989,6 @@ void rtl92e_copy_mpdu_stats(struct rtllib_rx_stats *psrc_stats,
 	ptarget_stats->bFirstMPDU = psrc_stats->bFirstMPDU;
 }
 
-
-
 static void _rtl92e_rx_normal(struct net_device *dev)
 {
 	struct r8192_priv *priv = rtllib_priv(dev);
@@ -2031,7 +2001,7 @@ static void _rtl92e_rx_normal(struct net_device *dev)
 
 	struct rtllib_rx_stats stats = {
 		.signal = 0,
-		.noise = (u8) -98,
+		.noise = (u8)-98,
 		.rate = 0,
 		.freq = RTLLIB_24GHZ_BAND,
 	};
@@ -2049,7 +2019,7 @@ static void _rtl92e_rx_normal(struct net_device *dev)
 		if (pdesc->OWN)
 			return;
 		if (!priv->ops->rx_query_status_descriptor(dev, &stats,
-		pdesc, skb))
+							   pdesc, skb))
 			goto done;
 		new_skb = dev_alloc_skb(priv->rxbuffersize);
 		/* if allocation of new skb failed - drop current packet
@@ -2059,13 +2029,13 @@ static void _rtl92e_rx_normal(struct net_device *dev)
 			goto done;
 
 		pci_unmap_single(priv->pdev,
-				*((dma_addr_t *)skb->cb),
-				priv->rxbuffersize,
-				PCI_DMA_FROMDEVICE);
+				 *((dma_addr_t *)skb->cb),
+				 priv->rxbuffersize,
+				 PCI_DMA_FROMDEVICE);
 
 		skb_put(skb, pdesc->Length);
 		skb_reserve(skb, stats.RxDrvInfoSize +
-			stats.RxBufShift);
+			    stats.RxBufShift);
 		skb_trim(skb, skb->len - 4/*sCrcLng*/);
 		rtllib_hdr = (struct rtllib_hdr_1addr *)skb->data;
 		if (!is_multicast_ether_addr(rtllib_hdr->addr1)) {
@@ -2104,7 +2074,7 @@ static void _rtl92e_rx_normal(struct net_device *dev)
 
 		priv->rx_buf[rx_queue_idx][priv->rx_idx[rx_queue_idx]] =
 								 skb;
-		*((dma_addr_t *) skb->cb) = pci_map_single(priv->pdev,
+		*((dma_addr_t *)skb->cb) = pci_map_single(priv->pdev,
 					    skb_tail_pointer_rsl(skb),
 					    priv->rxbuffersize,
 					    PCI_DMA_FROMDEVICE);
@@ -2117,12 +2087,11 @@ static void _rtl92e_rx_normal(struct net_device *dev)
 		pdesc->BufferAddress = *((dma_addr_t *)skb->cb);
 		pdesc->OWN = 1;
 		pdesc->Length = priv->rxbuffersize;
-		if (priv->rx_idx[rx_queue_idx] == priv->rxringcount-1)
+		if (priv->rx_idx[rx_queue_idx] == priv->rxringcount - 1)
 			pdesc->EOR = 1;
 		priv->rx_idx[rx_queue_idx] = (priv->rx_idx[rx_queue_idx] + 1) %
 					      priv->rxringcount;
 	}
-
 }
 
 static void _rtl92e_tx_resume(struct net_device *dev)
@@ -2135,7 +2104,8 @@ static void _rtl92e_tx_resume(struct net_device *dev)
 	for (queue_index = BK_QUEUE;
 	     queue_index < MAX_QUEUE_SIZE; queue_index++) {
 		while ((!skb_queue_empty(&ieee->skb_waitQ[queue_index])) &&
-		(priv->rtllib->check_nic_enough_desc(dev, queue_index) > 0)) {
+		       (priv->rtllib->check_nic_enough_desc(dev,
+							    queue_index) > 0)) {
 			skb = skb_dequeue(&ieee->skb_waitQ[queue_index]);
 			ieee->softmac_data_hard_start_xmit(skb, dev, 0);
 		}
@@ -2155,9 +2125,7 @@ static void _rtl92e_irq_rx_tasklet(struct r8192_priv *priv)
 		      rtl92e_readl(priv->rtllib->dev, INTA_MASK) | IMR_RDU);
 }
 
-/****************************************************************************
- ---------------------------- NIC START/CLOSE STUFF---------------------------
-*****************************************************************************/
+/* NIC START/CLOSE STUFF */
 static void _rtl92e_cancel_deferred_work(struct r8192_priv *priv)
 {
 	cancel_delayed_work_sync(&priv->watch_dog_wq);
@@ -2183,7 +2151,6 @@ static int _rtl92e_open(struct net_device *dev)
 	ret = _rtl92e_try_up(dev);
 	mutex_unlock(&priv->wx_mutex);
 	return ret;
-
 }
 
 static int _rtl92e_try_up(struct net_device *dev)
@@ -2195,32 +2162,25 @@ static int _rtl92e_try_up(struct net_device *dev)
 	return _rtl92e_up(dev, false);
 }
 
-
 static int _rtl92e_close(struct net_device *dev)
 {
 	struct r8192_priv *priv = rtllib_priv(dev);
 	int ret;
 
 	if ((rtllib_act_scanning(priv->rtllib, false)) &&
-		!(priv->rtllib->softmac_features & IEEE_SOFTMAC_SCAN)) {
+	    !(priv->rtllib->softmac_features & IEEE_SOFTMAC_SCAN)) {
 		rtllib_stop_scan(priv->rtllib);
 	}
-
 	mutex_lock(&priv->wx_mutex);
-
 	ret = _rtl92e_down(dev, true);
-
 	mutex_unlock(&priv->wx_mutex);
-
 	return ret;
-
 }
 
 static int _rtl92e_down(struct net_device *dev, bool shutdownrf)
 {
 	if (_rtl92e_sta_down(dev, shutdownrf) == -1)
 		return -1;
-
 	return 0;
 }
 
@@ -2243,9 +2203,7 @@ static void _rtl92e_restart(void *data)
 	struct net_device *dev = priv->rtllib->dev;
 
 	mutex_lock(&priv->wx_mutex);
-
 	rtl92e_commit(dev);
-
 	mutex_unlock(&priv->wx_mutex);
 }
 
@@ -2256,22 +2214,17 @@ static void _rtl92e_set_multicast(struct net_device *dev)
 
 	promisc = (dev->flags & IFF_PROMISC) ? 1 : 0;
 	priv->promisc = promisc;
-
 }
 
-
 static int _rtl92e_set_mac_adr(struct net_device *dev, void *mac)
 {
 	struct r8192_priv *priv = rtllib_priv(dev);
 	struct sockaddr *addr = mac;
 
 	mutex_lock(&priv->wx_mutex);
-
 	ether_addr_copy(dev->dev_addr, addr->sa_data);
-
 	schedule_work(&priv->reset_wq);
 	mutex_unlock(&priv->wx_mutex);
-
 	return 0;
 }
 
@@ -2283,7 +2236,8 @@ static int _rtl92e_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 	int ret = -1;
 	struct rtllib_device *ieee = priv->rtllib;
 	u32 key[4];
-	const u8 broadcast_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
+	const u8 broadcast_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff,
+									0xff};
 	struct iw_point *p = &wrq->u.data;
 	struct ieee_param *ipw = NULL;
 
@@ -2320,36 +2274,39 @@ static int _rtl92e_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 				}
 
 				if (ieee->pairwise_key_type) {
-					if (is_zero_ether_addr(ieee->ap_mac_addr))
+					if (is_zero_ether_addr(
+							ieee->ap_mac_addr))
 						ieee->iw_mode = IW_MODE_ADHOC;
 					memcpy((u8 *)key, ipw->u.crypt.key, 16);
 					rtl92e_enable_hw_security_config(dev);
 					rtl92e_set_swcam(dev, 4,
 							 ipw->u.crypt.idx,
-							 ieee->pairwise_key_type,
-							 (u8 *)ieee->ap_mac_addr,
-							 0, key, 0);
+							ieee->pairwise_key_type,
+							(u8 *)ieee->ap_mac_addr,
+								0, key, 0);
 					rtl92e_set_key(dev, 4, ipw->u.crypt.idx,
 						       ieee->pairwise_key_type,
 						       (u8 *)ieee->ap_mac_addr,
-						       0, key);
+								0, key);
 					if (ieee->iw_mode == IW_MODE_ADHOC) {
-						rtl92e_set_swcam(dev,
-								 ipw->u.crypt.idx,
-								 ipw->u.crypt.idx,
-								 ieee->pairwise_key_type,
-								 (u8 *)ieee->ap_mac_addr,
-								 0, key, 0);
-						rtl92e_set_key(dev,
-							       ipw->u.crypt.idx,
-							       ipw->u.crypt.idx,
-							       ieee->pairwise_key_type,
-							       (u8 *)ieee->ap_mac_addr,
-							       0, key);
+						rtl92e_set_swcam
+						(dev, ipw->u.crypt.idx,
+						 ipw->u.crypt.idx,
+						 ieee->pairwise_key_type,
+						 (u8 *)ieee->ap_mac_addr,
+							 0, key, 0);
+						rtl92e_set_key
+						(dev,
+						 ipw->u.crypt.idx,
+						 ipw->u.crypt.idx,
+						 ieee->pairwise_key_type,
+						 (u8 *)ieee->ap_mac_addr,
+								0, key);
 					}
 				}
-				if ((ieee->pairwise_key_type == KEY_TYPE_CCMP)
-				     && ieee->pHTInfo->bCurrentHTSupport) {
+				if ((ieee->pairwise_key_type ==
+				     KEY_TYPE_CCMP) &&
+				     ieee->pHTInfo->bCurrentHTSupport) {
 					rtl92e_writeb(dev, 0x173, 1);
 				}
 
@@ -2359,7 +2316,7 @@ static int _rtl92e_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 					ieee->group_key_type = KEY_TYPE_CCMP;
 				else if (strcmp(ipw->u.crypt.alg, "TKIP") == 0)
 					ieee->group_key_type = KEY_TYPE_TKIP;
-				else if (strcmp(ipw->u.crypt.alg, "WEP") == 0) {
+				else if (strcmp(ipw->u.crypt.alg, "WEP") == 0)
 					if (ipw->u.crypt.key_len == 13)
 						ieee->group_key_type =
 							 KEY_TYPE_WEP104;
@@ -2382,7 +2339,6 @@ static int _rtl92e_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 				}
 			}
 		}
-
 		ret = rtllib_wpa_supplicant_ioctl(priv->rtllib, &wrq->u.data,
 						  0);
 		kfree(ipw);
@@ -2394,11 +2350,9 @@ static int _rtl92e_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 
 out:
 	mutex_unlock(&priv->wx_mutex);
-
 	return ret;
 }
 
-
 static irqreturn_t _rtl92e_irq(int irq, void *netdev)
 {
 	struct net_device *dev = netdev;
@@ -2532,11 +2486,7 @@ static irqreturn_t _rtl92e_irq(int irq, void *netdev)
 	return IRQ_HANDLED;
 }
 
-
-
-/****************************************************************************
-	---------------------------- PCI_STUFF---------------------------
-*****************************************************************************/
+/* PCI_STUFF */
 static const struct net_device_ops rtl8192_netdev_ops = {
 	.ndo_open = _rtl92e_open,
 	.ndo_stop = _rtl92e_close,
@@ -2609,7 +2559,6 @@ static int _rtl92e_pci_probe(struct pci_dev *pdev,
 		goto err_rel_rtllib;
 	}
 
-
 	ioaddr = (unsigned long)ioremap_nocache(pmem_start, pmem_len);
 	if (ioaddr == (unsigned long)NULL) {
 		netdev_err(dev, "ioremap failed!");
@@ -2711,7 +2660,7 @@ static void _rtl92e_pci_disconnect(struct pci_dev *pdev)
 		if (dev->mem_start != 0) {
 			iounmap((void __iomem *)dev->mem_start);
 			release_mem_region(pci_resource_start(pdev, 1),
-					pci_resource_len(pdev, 1));
+					   pci_resource_len(pdev, 1));
 		}
 	} else {
 		priv = rtllib_priv(dev);
@@ -2726,7 +2675,7 @@ bool rtl92e_enable_nic(struct net_device *dev)
 	bool init_status = true;
 	struct r8192_priv *priv = rtllib_priv(dev);
 	struct rt_pwr_save_ctrl *pPSC = (struct rt_pwr_save_ctrl *)
-					(&(priv->rtllib->PowerSaveControl));
+					(&priv->rtllib->PowerSaveControl);
 
 	if (!priv->up) {
 		netdev_warn(dev, "%s(): Driver is already down!\n", __func__);
@@ -2751,6 +2700,7 @@ bool rtl92e_enable_nic(struct net_device *dev)
 	RT_TRACE(COMP_PS, "<===========%s()\n", __func__);
 	return init_status;
 }
+
 bool rtl92e_disable_nic(struct net_device *dev)
 {
 	struct r8192_priv *priv = rtllib_priv(dev);
@@ -2784,9 +2734,7 @@ void rtl92e_check_rfctrl_gpio_timer(unsigned long data)
 		  msecs_to_jiffies(RTLLIB_WATCH_DOG_TIME));
 }
 
-/***************************************************************************
-	------------------- module init / exit stubs ----------------
-****************************************************************************/
+/* module init / exit stubs */
 MODULE_DESCRIPTION("Linux driver for Realtek RTL819x WiFi cards");
 MODULE_AUTHOR(DRV_COPYRIGHT " " DRV_AUTHOR);
 MODULE_VERSION(DRV_VERSION);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v2 2/5] staging: rtl8192e: Improve error handling
  2017-03-09 18:50   ` [PATCH v2 0/5] staging: rtl8192e: Fix coding style, warnings and checks sunil.m
  2017-03-09 18:50     ` [PATCH v2 1/5] staging: rtl8192e: Fix coding style issues sunil.m
@ 2017-03-09 18:50     ` sunil.m
  2017-03-09 18:50     ` [PATCH v2 3/5] staging: rtl8192e: Rectify pointer comparisions sunil.m
                       ` (2 subsequent siblings)
  4 siblings, 0 replies; 40+ messages in thread
From: sunil.m @ 2017-03-09 18:50 UTC (permalink / raw)
  To: gregkh, dan.carpenter; +Cc: devel, linux-kernel, suniel.spartan, Suniel Mahesh

From: Suniel Mahesh <sunil.m@techveda.org>

Return -ENOMEM, if it is out of memory

Signed-off-by: Suniel Mahesh <sunil.m@techveda.org>
---
Changes for v2:

- Improve error handling reported by checkpatch.pl in rtl_core.c
- new patch addition to the series
- Rebased on top of next-20170306
---
 drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
index 349c49b..2e6b03f 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
@@ -967,8 +967,7 @@ static void _rtl92e_init_priv_variable(struct net_device *dev)
 
 	priv->pFirmware = vzalloc(sizeof(struct rt_firmware));
 	if (!priv->pFirmware)
-		netdev_err(dev,
-			   "rtl8192e: Unable to allocate space for firmware\n");
+		return -ENOMEM;
 	skb_queue_head_init(&priv->skb_queue);
 
 	for (i = 0; i < MAX_QUEUE_SIZE; i++)
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v2 3/5] staging: rtl8192e: Rectify pointer comparisions
  2017-03-09 18:50   ` [PATCH v2 0/5] staging: rtl8192e: Fix coding style, warnings and checks sunil.m
  2017-03-09 18:50     ` [PATCH v2 1/5] staging: rtl8192e: Fix coding style issues sunil.m
  2017-03-09 18:50     ` [PATCH v2 2/5] staging: rtl8192e: Improve error handling sunil.m
@ 2017-03-09 18:50     ` sunil.m
  2017-03-09 18:50     ` [PATCH v2 4/5] staging: rtl8192e: Fix unbalanced braces around else statement sunil.m
  2017-03-09 18:50     ` [PATCH v2 5/5] staging: rtl8192e: Pass a pointer as an argument to sizeof() instead of struct sunil.m
  4 siblings, 0 replies; 40+ messages in thread
From: sunil.m @ 2017-03-09 18:50 UTC (permalink / raw)
  To: gregkh, dan.carpenter; +Cc: devel, linux-kernel, suniel.spartan, Suniel Mahesh

From: Suniel Mahesh <sunil.m@techveda.org>

Pointer comparison with NULL replaced by logical NOT

Signed-off-by: Suniel Mahesh <sunil.m@techveda.org>
---
Changes for v2:

- Rectify pointer comparisions reported by checkpatch.pl in rtl_core.c
- new patch addition to the series
- Rebased on top of next-20170306
---
 drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
index 2e6b03f..028755b 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
@@ -469,7 +469,7 @@ static int _rtl92e_qos_assoc_resp(struct r8192_priv *priv,
 	u32 size = sizeof(struct rtllib_qos_parameters);
 	int set_qos_param = 0;
 
-	if ((priv == NULL) || (network == NULL))
+	if (!priv || !network)
 		return 0;
 
 	if (priv->rtllib->state != RTLLIB_LINKED)
@@ -782,7 +782,7 @@ static int _rtl92e_sta_down(struct net_device *dev, bool shutdownrf)
 	if (priv->up == 0)
 		return -1;
 
-	if (priv->rtllib->rtllib_ips_leave != NULL)
+	if (priv->rtllib->rtllib_ips_leave)
 		priv->rtllib->rtllib_ips_leave(dev);
 
 	if (priv->rtllib->state == RTLLIB_LINKED)
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v2 4/5] staging: rtl8192e: Fix unbalanced braces around else statement
  2017-03-09 18:50   ` [PATCH v2 0/5] staging: rtl8192e: Fix coding style, warnings and checks sunil.m
                       ` (2 preceding siblings ...)
  2017-03-09 18:50     ` [PATCH v2 3/5] staging: rtl8192e: Rectify pointer comparisions sunil.m
@ 2017-03-09 18:50     ` sunil.m
  2017-03-09 18:50     ` [PATCH v2 5/5] staging: rtl8192e: Pass a pointer as an argument to sizeof() instead of struct sunil.m
  4 siblings, 0 replies; 40+ messages in thread
From: sunil.m @ 2017-03-09 18:50 UTC (permalink / raw)
  To: gregkh, dan.carpenter; +Cc: devel, linux-kernel, suniel.spartan, Suniel Mahesh

From: Suniel Mahesh <sunil.m@techveda.org>

Fix unbalanced braces around else statement reported by checkpatch.pl

Signed-off-by: Suniel Mahesh <sunil.m@techveda.org>
---
Changes for v2:

- new patch addition to the series
- Rebased on top of next-20170306
---
 drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
index 028755b..fb711d2 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
@@ -2257,17 +2257,20 @@ static int _rtl92e_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 
 		if (ipw->cmd == IEEE_CMD_SET_ENCRYPTION) {
 			if (ipw->u.crypt.set_tx) {
-				if (strcmp(ipw->u.crypt.alg, "CCMP") == 0)
+				if (strcmp(ipw->u.crypt.alg, "CCMP") == 0) {
 					ieee->pairwise_key_type = KEY_TYPE_CCMP;
-				else if (strcmp(ipw->u.crypt.alg, "TKIP") == 0)
+				} else if (strcmp(ipw->u.crypt.alg,
+						  "TKIP") == 0) {
 					ieee->pairwise_key_type = KEY_TYPE_TKIP;
-				else if (strcmp(ipw->u.crypt.alg, "WEP") == 0) {
-					if (ipw->u.crypt.key_len == 13)
+				} else if (strcmp(ipw->u.crypt.alg,
+						  "WEP") == 0) {
+					if (ipw->u.crypt.key_len == 13) {
 						ieee->pairwise_key_type =
 							 KEY_TYPE_WEP104;
-					else if (ipw->u.crypt.key_len == 5)
+					} else if (ipw->u.crypt.key_len == 5) {
 						ieee->pairwise_key_type =
 							 KEY_TYPE_WEP40;
+					}
 				} else {
 					ieee->pairwise_key_type = KEY_TYPE_NA;
 				}
@@ -2322,9 +2325,9 @@ static int _rtl92e_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 					else if (ipw->u.crypt.key_len == 5)
 						ieee->group_key_type =
 							 KEY_TYPE_WEP40;
-				} else
+				} else {
 					ieee->group_key_type = KEY_TYPE_NA;
-
+				}
 				if (ieee->group_key_type) {
 					rtl92e_set_swcam(dev, ipw->u.crypt.idx,
 							 ipw->u.crypt.idx,
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v2 5/5] staging: rtl8192e: Pass a pointer as an argument to sizeof() instead of struct
  2017-03-09 18:50   ` [PATCH v2 0/5] staging: rtl8192e: Fix coding style, warnings and checks sunil.m
                       ` (3 preceding siblings ...)
  2017-03-09 18:50     ` [PATCH v2 4/5] staging: rtl8192e: Fix unbalanced braces around else statement sunil.m
@ 2017-03-09 18:50     ` sunil.m
  2017-03-17  9:58       ` Suniel Mahesh
  4 siblings, 1 reply; 40+ messages in thread
From: sunil.m @ 2017-03-09 18:50 UTC (permalink / raw)
  To: gregkh, dan.carpenter; +Cc: devel, linux-kernel, suniel.spartan, Suniel Mahesh

From: Suniel Mahesh <sunil.m@techveda.org>

Prefer vzalloc(sizeof(*priv->pFirmware)...) over
vzalloc(sizeof(struct rt_firmware)...) as reported by checkpatch.pl

Signed-off-by: Suniel Mahesh <sunil.m@techveda.org>
---
Changes for v2:

- new patch addition to the series
- Rebased on top of next-20170306
---
 drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
index fb711d2..a099bce 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
@@ -965,7 +965,7 @@ static void _rtl92e_init_priv_variable(struct net_device *dev)
 
 	priv->card_type = PCI;
 
-	priv->pFirmware = vzalloc(sizeof(struct rt_firmware));
+	priv->pFirmware = vzalloc(sizeof(*priv->pFirmware));
 	if (!priv->pFirmware)
 		return -ENOMEM;
 	skb_queue_head_init(&priv->skb_queue);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 40+ messages in thread

* Re: [PATCH v2 1/5] staging: rtl8192e: Fix coding style issues
  2017-03-09 18:50     ` [PATCH v2 1/5] staging: rtl8192e: Fix coding style issues sunil.m
@ 2017-03-11  8:11       ` kbuild test robot
  2017-03-12 13:41       ` Greg KH
  1 sibling, 0 replies; 40+ messages in thread
From: kbuild test robot @ 2017-03-11  8:11 UTC (permalink / raw)
  To: sunil.m
  Cc: kbuild-all, gregkh, dan.carpenter, devel, linux-kernel,
	suniel.spartan, Suniel Mahesh

[-- Attachment #1: Type: text/plain, Size: 9796 bytes --]

Hi Suniel,

[auto build test ERROR on staging/staging-testing]
[also build test ERROR on v4.11-rc1 next-20170310]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/sunil-m-techveda-org/staging-rtl8192e-Fix-coding-style-warnings-and-checks/20170311-122226
config: x86_64-rhel (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

   drivers/staging/rtl8192e/rtl8192e/rtl_core.c: In function 'rtl92e_set_rf_state':
>> drivers/staging/rtl8192e/rtl8192e/rtl_core.c:220:13: error: 'WLAN_REASON_DISASSOC_STA_' undeclared (first use in this function)
                WLAN_REASON_DISASSOC_STA_
                ^~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/rtl8192e/rtl8192e/rtl_core.c:220:13: note: each undeclared identifier is reported only once for each function it appears in
>> drivers/staging/rtl8192e/rtl8192e/rtl_core.c:221:9: error: expected ')' before 'HAS_LEFT'
            HAS_LEFT);
            ^~~~~~~~
   drivers/staging/rtl8192e/rtl8192e/rtl_core.c: In function '_rtl92e_if_silent_reset':
   drivers/staging/rtl8192e/rtl8192e/rtl_core.c:1248:24: warning: missing terminating " character
      RT_TRACE(COMP_RESET, "%s():======>start to down the
                           ^
   drivers/staging/rtl8192e/rtl8192e/rtl_core.c:1249:13: warning: missing terminating " character
        driver\n",  __func__);
                ^
   drivers/staging/rtl8192e/rtl8192e/rtl_core.c:1252:5: warning: missing terminating " character
        "%s():111111111111111111111111======>start to down the
        ^
   drivers/staging/rtl8192e/rtl8192e/rtl_core.c:1253:13: warning: missing terminating " character
        driver\n",  __func__);
                ^
>> drivers/staging/rtl8192e/rtl8192e/rtl_core.c:2752:0: error: unterminated argument list invoking macro "RT_TRACE"
    MODULE_PARM_DESC(channels, " Channel bitmask for specific locales. NYI");
    
>> drivers/staging/rtl8192e/rtl8192e/rtl_core.c:1248:3: error: 'RT_TRACE' undeclared (first use in this function)
      RT_TRACE(COMP_RESET, "%s():======>start to down the
      ^~~~~~~~
>> drivers/staging/rtl8192e/rtl8192e/rtl_core.c:1248:3: error: expected ';' at end of input
>> drivers/staging/rtl8192e/rtl8192e/rtl_core.c:1248:3: error: expected declaration or statement at end of input
>> drivers/staging/rtl8192e/rtl8192e/rtl_core.c:1248:3: error: expected declaration or statement at end of input
   drivers/staging/rtl8192e/rtl8192e/rtl_core.c:1233:1: warning: label 'RESET_START' defined but not used [-Wunused-label]
    RESET_START:
    ^~~~~~~~~~~
>> drivers/staging/rtl8192e/rtl8192e/rtl_core.c:1227:4: error: label 'END' used but not defined
       goto END;
       ^~~~
   drivers/staging/rtl8192e/rtl8192e/rtl_core.c:1218:24: warning: unused variable 'ieee' [-Wunused-variable]
     struct rtllib_device *ieee = priv->rtllib;
                           ^~~~
   drivers/staging/rtl8192e/rtl8192e/rtl_core.c:1217:6: warning: unused variable 'reset_status' [-Wunused-variable]
     int reset_status = 0;
         ^~~~~~~~~~~~
   drivers/staging/rtl8192e/rtl8192e/rtl_core.c:1216:5: warning: unused variable 'reset_times' [-Wunused-variable]
     u8 reset_times = 0;
        ^~~~~~~~~~~
   drivers/staging/rtl8192e/rtl8192e/rtl_core.c: At top level:
   drivers/staging/rtl8192e/rtl8192e/rtl_core.c:71:12: warning: '_rtl92e_pci_probe' used but never defined
    static int _rtl92e_pci_probe(struct pci_dev *pdev,
               ^~~~~~~~~~~~~~~~~
   drivers/staging/rtl8192e/rtl8192e/rtl_core.c:73:13: warning: '_rtl92e_pci_disconnect' used but never defined
    static void _rtl92e_pci_disconnect(struct pci_dev *pdev);
                ^~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/rtl8192e/rtl8192e/rtl_core.c:74:20: warning: '_rtl92e_irq' used but never defined
    static irqreturn_t _rtl92e_irq(int irq, void *netdev);
                       ^~~~~~~~~~~
   drivers/staging/rtl8192e/rtl8192e/rtl_core.c:86:13: warning: '_rtl92e_watchdog_wq_cb' used but never defined
    static void _rtl92e_watchdog_wq_cb(void *data);
                ^~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/rtl8192e/rtl8192e/rtl_core.c:87:13: warning: '_rtl92e_watchdog_timer_cb' used but never defined
    static void _rtl92e_watchdog_timer_cb(unsigned long data);
                ^~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/rtl8192e/rtl8192e/rtl_core.c:88:13: warning: '_rtl92e_hard_data_xmit' used but never defined
    static void _rtl92e_hard_data_xmit(struct sk_buff *skb, struct net_device *dev,
                ^~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/rtl8192e/rtl8192e/rtl_core.c:90:12: warning: '_rtl92e_hard_start_xmit' used but never defined
    static int _rtl92e_hard_start_xmit(struct sk_buff *skb, struct net_device *dev);
               ^~~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/rtl8192e/rtl8192e/rtl_core.c:91:13: warning: '_rtl92e_tx_cmd' declared 'static' but never defined [-Wunused-function]
    static void _rtl92e_tx_cmd(struct net_device *dev, struct sk_buff *skb);
                ^~~~~~~~~~~~~~
   drivers/staging/rtl8192e/rtl8192e/rtl_core.c:92:14: warning: '_rtl92e_tx' declared 'static' but never defined [-Wunused-function]
    static short _rtl92e_tx(struct net_device *dev, struct sk_buff *skb);
                 ^~~~~~~~~~
   drivers/staging/rtl8192e/rtl8192e/rtl_core.c:93:14: warning: '_rtl92e_pci_initdescring' used but never defined
    static short _rtl92e_pci_initdescring(struct net_device *dev);
                 ^~~~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/rtl8192e/rtl8192e/rtl_core.c:94:13: warning: '_rtl92e_irq_tx_tasklet' used but never defined
    static void _rtl92e_irq_tx_tasklet(struct r8192_priv *priv);
                ^~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/rtl8192e/rtl8192e/rtl_core.c:95:13: warning: '_rtl92e_irq_rx_tasklet' used but never defined
    static void _rtl92e_irq_rx_tasklet(struct r8192_priv *priv);
                ^~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/rtl8192e/rtl8192e/rtl_core.c:96:13: warning: '_rtl92e_cancel_deferred_work' used but never defined
    static void _rtl92e_cancel_deferred_work(struct r8192_priv *priv);
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/rtl8192e/rtl8192e/rtl_core.c:97:12: warning: '_rtl92e_up' declared 'static' but never defined [-Wunused-function]
    static int _rtl92e_up(struct net_device *dev, bool is_silent_reset);
               ^~~~~~~~~~
   drivers/staging/rtl8192e/rtl8192e/rtl_core.c:98:12: warning: '_rtl92e_try_up' declared 'static' but never defined [-Wunused-function]
    static int _rtl92e_try_up(struct net_device *dev);
               ^~~~~~~~~~~~~~
   drivers/staging/rtl8192e/rtl8192e/rtl_core.c:99:12: warning: '_rtl92e_down' declared 'static' but never defined [-Wunused-function]
    static int _rtl92e_down(struct net_device *dev, bool shutdownrf);
               ^~~~~~~~~~~~
   drivers/staging/rtl8192e/rtl8192e/rtl_core.c:100:13: warning: '_rtl92e_restart' used but never defined
    static void _rtl92e_restart(void *data);
                ^~~~~~~~~~~~~~~
   drivers/staging/rtl8192e/rtl8192e/rtl_core.c:1213:13: warning: '_rtl92e_if_silent_reset' defined but not used [-Wunused-function]
    static void _rtl92e_if_silent_reset(struct net_device *dev)
                ^~~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/rtl8192e/rtl8192e/rtl_core.c:1181:24: warning: '_rtl92e_if_check_reset' defined but not used [-Wunused-function]
    static enum reset_type _rtl92e_if_check_reset(struct net_device *dev)
                           ^~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/rtl8192e/rtl8192e/rtl_core.c:1051:14: warning: '_rtl92e_init' defined but not used [-Wunused-function]
    static short _rtl92e_init(struct net_device *dev)
                 ^~~~~~~~~~~~
   drivers/staging/rtl8192e/rtl8192e/rtl_core.c:776:12: warning: '_rtl92e_sta_down' defined but not used [-Wunused-function]
    static int _rtl92e_sta_down(struct net_device *dev, bool shutdownrf)
               ^~~~~~~~~~~~~~~~
   drivers/staging/rtl8192e/rtl8192e/rtl_core.c:733:12: warning: '_rtl92e_sta_up' defined but not used [-Wunused-function]
    static int _rtl92e_sta_up(struct net_device *dev, bool is_silent_reset)
               ^~~~~~~~~~~~~~
   drivers/staging/rtl8192e/rtl8192e/rtl_core.c:275:13: warning: '_rtl92e_tx_timeout' defined but not used [-Wunused-function]
    static void _rtl92e_tx_timeout(struct net_device *dev)
                ^~~~~~~~~~~~~~~~~~
   drivers/staging/rtl8192e/rtl8192e/rtl_core.c:76:26: warning: 'rtl8192_pci_driver' defined but not used [-Wunused-variable]
    static struct pci_driver rtl8192_pci_driver = {
                             ^~~~~~~~~~~~~~~~~~
   drivers/staging/rtl8192e/rtl8192e/rtl_core.c:38:14: warning: 'ifname' defined but not used [-Wunused-variable]
    static char *ifname = "wlan%d";
                 ^~~~~~
   drivers/staging/rtl8192e/rtl8192e/rtl_core.c:37:12: warning: 'channels' defined but not used [-Wunused-variable]
    static int channels = 0x3fff;
               ^~~~~~~~

vim +/WLAN_REASON_DISASSOC_STA_ +220 drivers/staging/rtl8192e/rtl8192e/rtl_core.c

   214				    (ChangeSource > RF_CHANGE_BY_IPS)) {
   215					if (ieee->state == RTLLIB_LINKED)
   216						priv->blinked_ingpio = true;
   217					else
   218						priv->blinked_ingpio = false;
   219					rtllib_MgntDisconnect(priv->rtllib,
 > 220							      WLAN_REASON_DISASSOC_STA_
 > 221									HAS_LEFT);
   222				}
   223			}
   224			if ((ChangeSource == RF_CHANGE_BY_HW) && !priv->bHwRadioOff)

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 38803 bytes --]

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PATCH v2 1/5] staging: rtl8192e: Fix coding style issues
  2017-03-09 18:50     ` [PATCH v2 1/5] staging: rtl8192e: Fix coding style issues sunil.m
  2017-03-11  8:11       ` kbuild test robot
@ 2017-03-12 13:41       ` Greg KH
  2017-03-15  9:51         ` [PATCH v3 0/8] staging: rtl8192e: Fix coding style, warnings and checks sunil.m
  1 sibling, 1 reply; 40+ messages in thread
From: Greg KH @ 2017-03-12 13:41 UTC (permalink / raw)
  To: sunil.m; +Cc: dan.carpenter, devel, linux-kernel, suniel.spartan

On Fri, Mar 10, 2017 at 12:20:44AM +0530, sunil.m@techveda.org wrote:
> From: Suniel Mahesh <sunil.m@techveda.org>
> 
> Fix coding style issues and comments in rtl_core.c

What issues would that be?  Please always be specific and tell us what
you do.

Also always test-build your patches, otherwise you make maintainers
really really grumpy :(

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 40+ messages in thread

* [PATCH v3 0/8] staging: rtl8192e: Fix coding style, warnings and checks
  2017-03-12 13:41       ` Greg KH
@ 2017-03-15  9:51         ` sunil.m
  2017-03-15  9:51           ` [PATCH v3 1/8] staging: rtl8192e: Fix comments as per kernel coding style sunil.m
                             ` (7 more replies)
  0 siblings, 8 replies; 40+ messages in thread
From: sunil.m @ 2017-03-15  9:51 UTC (permalink / raw)
  To: gregkh, dan.carpenter; +Cc: devel, linux-kernel, karthiknishu, Suniel Mahesh

From: Suniel Mahesh <sunil.m@techveda.org>

Split earlier patches into multiple commits for easy review as 
suggested by Dan Carpenter.
Modified subject, description and in few patches both for
better readability as suggested by Greg KH.
Fixed the following issues reported by checkpatch.pl:
Block comments should align the * on each line, aligned.
Block comments use * on subsequent lines, other characters 
are replaced by * .
line over 80 characters, modified as per coding style.
Removed unnecessary 'out of memory' message.
Comparison's to NULL could be written '!foo' or 'foo', modified.
Fixed unbalanced braces around else statement.
Added braces on all arms of the if-else statements to comply with
kernel coding style.
Replaced sizeof(struct foo) into sizeof(*ptr).
Spaces preferred around that 'operator', spacing provided.
Logical continuations should be on the previous line, modified accordingly.
Unnecessary parentheses around variables, removed.
Please use a blank line after function/struct/union/enum declarations, used.
Blank lines aren't necessary after an open brace '{' and before a 
close brace '}', removed.
No space is necessary after a cast, removed.
Please don't use multiple blank lines, removed.

Rebased on top of next-20170310.
Patches were tested and built on next-20170310 and staging-testing
as suggested by Greg K-H, no errors reported.

Suniel Mahesh (8):
  staging: rtl8192e: Fix comments as per kernel coding style
  staging: rtl8192e: Fix coding style
  staging: rtl8192e: Remove unnecessary 'out of memory' message
  staging: rtl8192e: Rectify pointer comparisions with NULL
  staging: rtl8192e: Fix unbalanced braces
  staging: rtl8192e: Pass a pointer as an argument to sizeof() instead
    of struct
  staging: rtl8192e: Fix issues reported by checkpatch.pl
  staging: rtl8192e: Fix blank lines and space after a cast

 drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 201 +++++++++++----------------
 1 file changed, 84 insertions(+), 117 deletions(-)

-- 
1.9.1

^ permalink raw reply	[flat|nested] 40+ messages in thread

* [PATCH v3 1/8] staging: rtl8192e: Fix comments as per kernel coding style
  2017-03-15  9:51         ` [PATCH v3 0/8] staging: rtl8192e: Fix coding style, warnings and checks sunil.m
@ 2017-03-15  9:51           ` sunil.m
  2017-03-15  9:51           ` [PATCH v3 2/8] staging: rtl8192e: Fix " sunil.m
                             ` (6 subsequent siblings)
  7 siblings, 0 replies; 40+ messages in thread
From: sunil.m @ 2017-03-15  9:51 UTC (permalink / raw)
  To: gregkh, dan.carpenter; +Cc: devel, linux-kernel, karthiknishu, Suniel Mahesh

From: Suniel Mahesh <sunil.m@techveda.org>

Fixed the following checkpatch.pl warnings:
Block comments should align the * on each line
Block comments use * on subsequent lines

Signed-off-by: Suniel Mahesh <sunil.m@techveda.org>
---
Changes for v3:

- Split earlier patches into multiple commits for easy review
  as suggested by Greg K-H
- Modified subject and description for better readability
- Rebased on top of next-20170310
- Patches were tested and built on next-20170310 and staging-testing
  as suggested by Greg K-H, no errors reported

Changes for v2:

- Split larger patch into multiple commits as suggested
  by Dan Carpenter
- This patch fixes coding style issues, comments in rtl_core.c
  reported by checkpatch.pl
- Modified short description to 'Fix coding style issues' from
  'Fix coding style issues, improve error handling'
- Improve error handling is taken care by the following patch
  in the series
- Removed statements, 'Return -ENOMEM, if it is out of memory',
  'Pointer comparison with NULL replaced by logical NOT' from the
  body of the patch
- Rebased on top of next-20170306
---
 drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 61 ++++++++++------------------
 1 file changed, 22 insertions(+), 39 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
index 4c0caa6..a648064 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
@@ -1,4 +1,4 @@
-/******************************************************************************
+/*
  * Copyright(c) 2008 - 2010 Realtek Corporation. All rights reserved.
  *
  * Based on the r8180 driver, which is:
@@ -17,7 +17,7 @@
  *
  * Contact Information:
  * wlanfae <wlanfae@realtek.com>
-******************************************************************************/
+ */
 #include <linux/uaccess.h>
 #include <linux/pci.h>
 #include <linux/vmalloc.h>
@@ -75,12 +75,12 @@ static int _rtl92e_pci_probe(struct pci_dev *pdev,
 static irqreturn_t _rtl92e_irq(int irq, void *netdev);
 
 static struct pci_driver rtl8192_pci_driver = {
-	.name = DRV_NAME,	/* Driver name   */
-	.id_table = rtl8192_pci_id_tbl,	/* PCI_ID table  */
-	.probe	= _rtl92e_pci_probe,	/* probe fn      */
-	.remove	 = _rtl92e_pci_disconnect,	/* remove fn */
-	.suspend = rtl92e_suspend,	/* PM suspend fn */
-	.resume = rtl92e_resume,                 /* PM resume fn  */
+	.name = DRV_NAME,
+	.id_table = rtl8192_pci_id_tbl,
+	.probe	= _rtl92e_pci_probe,
+	.remove	 = _rtl92e_pci_disconnect,
+	.suspend = rtl92e_suspend,
+	.resume = rtl92e_resume,
 };
 
 static short _rtl92e_is_tx_queue_empty(struct net_device *dev);
@@ -100,10 +100,7 @@ static void _rtl92e_hard_data_xmit(struct sk_buff *skb, struct net_device *dev,
 static int _rtl92e_down(struct net_device *dev, bool shutdownrf);
 static void _rtl92e_restart(void *data);
 
-/****************************************************************************
-   -----------------------------IO STUFF-------------------------
-*****************************************************************************/
-
+/* IO STUFF */
 u8 rtl92e_readb(struct net_device *dev, int x)
 {
 	return 0xff & readb((u8 __iomem *)dev->mem_start + x);
@@ -140,9 +137,7 @@ void rtl92e_writew(struct net_device *dev, int x, u16 y)
 	udelay(20);
 }
 
-/****************************************************************************
-   -----------------------------GENERAL FUNCTION-------------------------
-*****************************************************************************/
+/* GENERAL FUNCTION */
 bool rtl92e_set_rf_state(struct net_device *dev,
 			 enum rt_rf_power_state StateToSet,
 			 RT_RF_CHANGE_SOURCE ChangeSource)
@@ -978,7 +973,6 @@ static void _rtl92e_init_priv_variable(struct net_device *dev)
 	if (!priv->pFirmware)
 		netdev_err(dev,
 			   "rtl8192e: Unable to allocate space for firmware\n");
-
 	skb_queue_head_init(&priv->skb_queue);
 
 	for (i = 0; i < MAX_QUEUE_SIZE; i++)
@@ -1101,9 +1095,7 @@ static short _rtl92e_init(struct net_device *dev)
 	return 0;
 }
 
-/***************************************************************************
-	-------------------------------WATCHDOG STUFF---------------------------
-***************************************************************************/
+/* WATCHDOG STUFF */
 static short _rtl92e_is_tx_queue_empty(struct net_device *dev)
 {
 	int i = 0;
@@ -1540,9 +1532,7 @@ static void _rtl92e_watchdog_timer_cb(unsigned long data)
 		  msecs_to_jiffies(RTLLIB_WATCH_DOG_TIME));
 }
 
-/****************************************************************************
- ---------------------------- NIC TX/RX STUFF---------------------------
-*****************************************************************************/
+/* NIC TX/RX STUFF */
 void rtl92e_rx_enable(struct net_device *dev)
 {
 	struct r8192_priv *priv = rtllib_priv(dev);
@@ -1982,6 +1972,7 @@ void rtl92e_update_rx_statistics(struct r8192_priv *priv,
 					weighting) / 6;
 }
 
+/* QueryRxPwrPercentage */
 u8 rtl92e_rx_db_to_percent(s8 antpower)
 {
 	if ((antpower <= -100) || (antpower >= 20))
@@ -1991,7 +1982,7 @@ u8 rtl92e_rx_db_to_percent(s8 antpower)
 	else
 		return	100 + antpower;
 
-}	/* QueryRxPwrPercentage */
+}
 
 u8 rtl92e_evm_db_to_percent(s8 value)
 {
@@ -2052,9 +2043,9 @@ static void _rtl92e_rx_normal(struct net_device *dev)
 		pdesc, skb))
 			goto done;
 		new_skb = dev_alloc_skb(priv->rxbuffersize);
-		/* if allocation of new skb failed - drop current packet
-		 * and reuse skb
-		 */
+/* if allocation of new skb failed - drop current packet
+ * and reuse skb
+ */
 		if (unlikely(!new_skb))
 			goto done;
 
@@ -2066,7 +2057,7 @@ static void _rtl92e_rx_normal(struct net_device *dev)
 		skb_put(skb, pdesc->Length);
 		skb_reserve(skb, stats.RxDrvInfoSize +
 			stats.RxBufShift);
-		skb_trim(skb, skb->len - 4/*sCrcLng*/);
+		skb_trim(skb, skb->len - 4/* sCrcLng */);
 		rtllib_hdr = (struct rtllib_hdr_1addr *)skb->data;
 		if (!is_multicast_ether_addr(rtllib_hdr->addr1)) {
 			/* unicast packet */
@@ -2155,9 +2146,7 @@ static void _rtl92e_irq_rx_tasklet(struct r8192_priv *priv)
 		      rtl92e_readl(priv->rtllib->dev, INTA_MASK) | IMR_RDU);
 }
 
-/****************************************************************************
- ---------------------------- NIC START/CLOSE STUFF---------------------------
-*****************************************************************************/
+/* NIC START/CLOSE STUFF */
 static void _rtl92e_cancel_deferred_work(struct r8192_priv *priv)
 {
 	cancel_delayed_work_sync(&priv->watch_dog_wq);
@@ -2532,11 +2521,7 @@ static irqreturn_t _rtl92e_irq(int irq, void *netdev)
 	return IRQ_HANDLED;
 }
 
-
-
-/****************************************************************************
-	---------------------------- PCI_STUFF---------------------------
-*****************************************************************************/
+/* PCI_STUFF */
 static const struct net_device_ops rtl8192_netdev_ops = {
 	.ndo_open = _rtl92e_open,
 	.ndo_stop = _rtl92e_close,
@@ -2620,7 +2605,7 @@ static int _rtl92e_pci_probe(struct pci_dev *pdev,
 	dev->mem_end = ioaddr + pci_resource_len(pdev, 0);
 
 	pci_read_config_byte(pdev, 0x08, &revision_id);
-	/* If the revisionid is 0x10, the device uses rtl8192se. */
+	/* If the revisionid is 0x10, the device uses rtl8192se */
 	if (pdev->device == 0x8192 && revision_id == 0x10)
 		goto err_unmap;
 
@@ -2784,9 +2769,7 @@ void rtl92e_check_rfctrl_gpio_timer(unsigned long data)
 		  msecs_to_jiffies(RTLLIB_WATCH_DOG_TIME));
 }
 
-/***************************************************************************
-	------------------- module init / exit stubs ----------------
-****************************************************************************/
+/* module init / exit stubs */
 MODULE_DESCRIPTION("Linux driver for Realtek RTL819x WiFi cards");
 MODULE_AUTHOR(DRV_COPYRIGHT " " DRV_AUTHOR);
 MODULE_VERSION(DRV_VERSION);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v3 2/8] staging: rtl8192e: Fix coding style
  2017-03-15  9:51         ` [PATCH v3 0/8] staging: rtl8192e: Fix coding style, warnings and checks sunil.m
  2017-03-15  9:51           ` [PATCH v3 1/8] staging: rtl8192e: Fix comments as per kernel coding style sunil.m
@ 2017-03-15  9:51           ` sunil.m
  2017-03-15 10:14             ` Dan Carpenter
  2017-03-15 10:15             ` Dan Carpenter
  2017-03-15  9:51           ` [PATCH v3 3/8] staging: rtl8192e: Remove unnecessary 'out of memory' message sunil.m
                             ` (5 subsequent siblings)
  7 siblings, 2 replies; 40+ messages in thread
From: sunil.m @ 2017-03-15  9:51 UTC (permalink / raw)
  To: gregkh, dan.carpenter; +Cc: devel, linux-kernel, karthiknishu, Suniel Mahesh

From: Suniel Mahesh <sunil.m@techveda.org>

Fixed the following checkpatch.pl warning:
line over 80 characters

Signed-off-by: Suniel Mahesh <sunil.m@techveda.org>
---
Changes for v3:

- Split earlier patches into multiple commits for easy review
  as suggested by Greg K-H
- New patch addition to the series
- Rebased on top of next-20170310
- Patches were tested and built on next-20170310 and staging-testing
  as suggested by Greg K-H, no errors reported

Changes for v2:
---
 drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 30 +++++++++++++++-------------
 1 file changed, 16 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
index a648064..eb2321c 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
@@ -218,7 +218,7 @@ bool rtl92e_set_rf_state(struct net_device *dev,
 				else
 					priv->blinked_ingpio = false;
 				rtllib_MgntDisconnect(priv->rtllib,
-						      WLAN_REASON_DISASSOC_STA_HAS_LEFT);
+					WLAN_REASON_DISASSOC_STA_HAS_LEFT);
 			}
 		}
 		if ((ChangeSource == RF_CHANGE_BY_HW) && !priv->bHwRadioOff)
@@ -1796,7 +1796,7 @@ static short _rtl92e_alloc_rx_ring(struct net_device *dev)
 
 	for (rx_queue_idx = 0; rx_queue_idx < MAX_RX_QUEUE; rx_queue_idx++) {
 		priv->rx_ring[rx_queue_idx] = pci_zalloc_consistent(priv->pdev,
-					      sizeof(*priv->rx_ring[rx_queue_idx]) * priv->rxringcount,
+		sizeof(*priv->rx_ring[rx_queue_idx]) * priv->rxringcount,
 					      &priv->rx_ring_dma[rx_queue_idx]);
 		if (!priv->rx_ring[rx_queue_idx] ||
 		    (unsigned long)priv->rx_ring[rx_queue_idx] & 0xFF) {
@@ -2272,7 +2272,8 @@ static int _rtl92e_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 	int ret = -1;
 	struct rtllib_device *ieee = priv->rtllib;
 	u32 key[4];
-	const u8 broadcast_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
+	const u8 broadcast_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff,
+									0xff};
 	struct iw_point *p = &wrq->u.data;
 	struct ieee_param *ipw = NULL;
 
@@ -2309,14 +2310,15 @@ static int _rtl92e_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 				}
 
 				if (ieee->pairwise_key_type) {
-					if (is_zero_ether_addr(ieee->ap_mac_addr))
+					if (is_zero_ether_addr(
+							ieee->ap_mac_addr))
 						ieee->iw_mode = IW_MODE_ADHOC;
 					memcpy((u8 *)key, ipw->u.crypt.key, 16);
 					rtl92e_enable_hw_security_config(dev);
 					rtl92e_set_swcam(dev, 4,
 							 ipw->u.crypt.idx,
-							 ieee->pairwise_key_type,
-							 (u8 *)ieee->ap_mac_addr,
+							ieee->pairwise_key_type,
+							(u8 *)ieee->ap_mac_addr,
 							 0, key, 0);
 					rtl92e_set_key(dev, 4, ipw->u.crypt.idx,
 						       ieee->pairwise_key_type,
@@ -2324,17 +2326,17 @@ static int _rtl92e_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 						       0, key);
 					if (ieee->iw_mode == IW_MODE_ADHOC) {
 						rtl92e_set_swcam(dev,
-								 ipw->u.crypt.idx,
-								 ipw->u.crypt.idx,
-								 ieee->pairwise_key_type,
-								 (u8 *)ieee->ap_mac_addr,
-								 0, key, 0);
+							ipw->u.crypt.idx,
+							ipw->u.crypt.idx,
+							ieee->pairwise_key_type,
+							(u8 *)ieee->ap_mac_addr,
+								0, key, 0);
 						rtl92e_set_key(dev,
 							       ipw->u.crypt.idx,
 							       ipw->u.crypt.idx,
-							       ieee->pairwise_key_type,
-							       (u8 *)ieee->ap_mac_addr,
-							       0, key);
+							ieee->pairwise_key_type,
+							(u8 *)ieee->ap_mac_addr,
+									0, key);
 					}
 				}
 				if ((ieee->pairwise_key_type == KEY_TYPE_CCMP)
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v3 3/8] staging: rtl8192e: Remove unnecessary 'out of memory' message
  2017-03-15  9:51         ` [PATCH v3 0/8] staging: rtl8192e: Fix coding style, warnings and checks sunil.m
  2017-03-15  9:51           ` [PATCH v3 1/8] staging: rtl8192e: Fix comments as per kernel coding style sunil.m
  2017-03-15  9:51           ` [PATCH v3 2/8] staging: rtl8192e: Fix " sunil.m
@ 2017-03-15  9:51           ` sunil.m
  2017-03-15 10:16             ` Dan Carpenter
  2017-03-15  9:51           ` [PATCH v3 4/8] staging: rtl8192e: Rectify pointer comparisions with NULL sunil.m
                             ` (4 subsequent siblings)
  7 siblings, 1 reply; 40+ messages in thread
From: sunil.m @ 2017-03-15  9:51 UTC (permalink / raw)
  To: gregkh, dan.carpenter; +Cc: devel, linux-kernel, karthiknishu, Suniel Mahesh

From: Suniel Mahesh <sunil.m@techveda.org>

Fixed the following checkpatch.pl warning:
Possible unnecessary 'out of memory' message

Signed-off-by: Suniel Mahesh <sunil.m@techveda.org>
---
Changes for v3:

- Split earlier patches into multiple commits for easy review
  as suggested by Greg K-H
- Modified subject and description for better readability
- Rebased on top of next-20170310
- Patches were tested and built on next-20170310 and staging-testing
  as suggested by Greg K-H, no errors reported

Changes for v2:

- Improve error handling reported by checkpatch.pl in rtl_core.c
- new patch addition to the series
- Rebased on top of next-20170306
---
 drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
index eb2321c..37a03ca 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
@@ -971,8 +971,8 @@ static void _rtl92e_init_priv_variable(struct net_device *dev)
 
 	priv->pFirmware = vzalloc(sizeof(struct rt_firmware));
 	if (!priv->pFirmware)
-		netdev_err(dev,
-			   "rtl8192e: Unable to allocate space for firmware\n");
+		return;
+
 	skb_queue_head_init(&priv->skb_queue);
 
 	for (i = 0; i < MAX_QUEUE_SIZE; i++)
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v3 4/8] staging: rtl8192e: Rectify pointer comparisions with NULL
  2017-03-15  9:51         ` [PATCH v3 0/8] staging: rtl8192e: Fix coding style, warnings and checks sunil.m
                             ` (2 preceding siblings ...)
  2017-03-15  9:51           ` [PATCH v3 3/8] staging: rtl8192e: Remove unnecessary 'out of memory' message sunil.m
@ 2017-03-15  9:51           ` sunil.m
  2017-03-15  9:51           ` [PATCH v3 5/8] staging: rtl8192e: Fix unbalanced braces sunil.m
                             ` (3 subsequent siblings)
  7 siblings, 0 replies; 40+ messages in thread
From: sunil.m @ 2017-03-15  9:51 UTC (permalink / raw)
  To: gregkh, dan.carpenter; +Cc: devel, linux-kernel, karthiknishu, Suniel Mahesh

From: Suniel Mahesh <sunil.m@techveda.org>

This patch simplifies code by replacing explicit NULL comparison
with ! or unmark operator
Reported by checkpatch.pl for comparison to NULL could be
written '!foo' or 'foo'

Signed-off-by: Suniel Mahesh <sunil.m@techveda.org>
---
Changes for v3:

- Split earlier patches into multiple commits for easy review
  as suggested by Greg K-H
- Modified description for better readability
- Rebased on top of next-20170310
- Patches were tested and built on next-20170310 and staging-testing
  as suggested by Greg K-H, no errors reported

Changes for v2:

- Rectify pointer comparisions reported by checkpatch.pl in rtl_core.c
- new patch addition to the series
- Rebased on top of next-20170306
---
 drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
index 37a03ca..0fa4017 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
@@ -472,7 +472,7 @@ static int _rtl92e_qos_assoc_resp(struct r8192_priv *priv,
 	u32 size = sizeof(struct rtllib_qos_parameters);
 	int set_qos_param = 0;
 
-	if ((priv == NULL) || (network == NULL))
+	if (!priv || !network)
 		return 0;
 
 	if (priv->rtllib->state != RTLLIB_LINKED)
@@ -785,7 +785,7 @@ static int _rtl92e_sta_down(struct net_device *dev, bool shutdownrf)
 	if (priv->up == 0)
 		return -1;
 
-	if (priv->rtllib->rtllib_ips_leave != NULL)
+	if (priv->rtllib->rtllib_ips_leave)
 		priv->rtllib->rtllib_ips_leave(dev);
 
 	if (priv->rtllib->state == RTLLIB_LINKED)
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v3 5/8] staging: rtl8192e: Fix unbalanced braces
  2017-03-15  9:51         ` [PATCH v3 0/8] staging: rtl8192e: Fix coding style, warnings and checks sunil.m
                             ` (3 preceding siblings ...)
  2017-03-15  9:51           ` [PATCH v3 4/8] staging: rtl8192e: Rectify pointer comparisions with NULL sunil.m
@ 2017-03-15  9:51           ` sunil.m
  2017-03-15 10:24             ` Dan Carpenter
  2017-03-15  9:51           ` [PATCH v3 6/8] staging: rtl8192e: Pass a pointer as an argument to sizeof() instead of struct sunil.m
                             ` (2 subsequent siblings)
  7 siblings, 1 reply; 40+ messages in thread
From: sunil.m @ 2017-03-15  9:51 UTC (permalink / raw)
  To: gregkh, dan.carpenter; +Cc: devel, linux-kernel, karthiknishu, Suniel Mahesh

From: Suniel Mahesh <sunil.m@techveda.org>

Fixed unbalanced braces around else statement
Add braces on all arms of the if-else statements to comply with
kernel coding style.

Signed-off-by: Suniel Mahesh <sunil.m@techveda.org>
---
Changes for v3:

- Split earlier patches into multiple commits for easy review
  as suggested by Greg K-H
- Modified subject and description for better readability
- Rebased on top of next-20170310
- Patches were tested and built on next-20170310 and staging-testing
  as suggested by Greg K-H, no errors reported

Changes for v2:

- new patch addition to the series
- Rebased on top of next-20170306
---
 drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 30 +++++++++++++++++-----------
 1 file changed, 18 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
index 0fa4017..c355ee7 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
@@ -2294,17 +2294,20 @@ static int _rtl92e_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 
 		if (ipw->cmd == IEEE_CMD_SET_ENCRYPTION) {
 			if (ipw->u.crypt.set_tx) {
-				if (strcmp(ipw->u.crypt.alg, "CCMP") == 0)
+				if (strcmp(ipw->u.crypt.alg, "CCMP") == 0) {
 					ieee->pairwise_key_type = KEY_TYPE_CCMP;
-				else if (strcmp(ipw->u.crypt.alg, "TKIP") == 0)
+				} else if (strcmp(ipw->u.crypt.alg,
+								"TKIP") == 0) {
 					ieee->pairwise_key_type = KEY_TYPE_TKIP;
-				else if (strcmp(ipw->u.crypt.alg, "WEP") == 0) {
-					if (ipw->u.crypt.key_len == 13)
+				} else if (strcmp(ipw->u.crypt.alg,
+								"WEP") == 0) {
+					if (ipw->u.crypt.key_len == 13) {
 						ieee->pairwise_key_type =
 							 KEY_TYPE_WEP104;
-					else if (ipw->u.crypt.key_len == 5)
+					} else if (ipw->u.crypt.key_len == 5) {
 						ieee->pairwise_key_type =
 							 KEY_TYPE_WEP40;
+					}
 				} else {
 					ieee->pairwise_key_type = KEY_TYPE_NA;
 				}
@@ -2346,20 +2349,23 @@ static int _rtl92e_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 
 			} else {
 				memcpy((u8 *)key, ipw->u.crypt.key, 16);
-				if (strcmp(ipw->u.crypt.alg, "CCMP") == 0)
+				if (strcmp(ipw->u.crypt.alg, "CCMP") == 0) {
 					ieee->group_key_type = KEY_TYPE_CCMP;
-				else if (strcmp(ipw->u.crypt.alg, "TKIP") == 0)
+				} else if (strcmp(ipw->u.crypt.alg,
+								"TKIP") == 0) {
 					ieee->group_key_type = KEY_TYPE_TKIP;
-				else if (strcmp(ipw->u.crypt.alg, "WEP") == 0) {
-					if (ipw->u.crypt.key_len == 13)
+				} else if (strcmp(ipw->u.crypt.alg,
+								"WEP") == 0) {
+					if (ipw->u.crypt.key_len == 13) {
 						ieee->group_key_type =
 							 KEY_TYPE_WEP104;
-					else if (ipw->u.crypt.key_len == 5)
+					} else if (ipw->u.crypt.key_len == 5) {
 						ieee->group_key_type =
 							 KEY_TYPE_WEP40;
-				} else
+					}
+				} else {
 					ieee->group_key_type = KEY_TYPE_NA;
-
+				}
 				if (ieee->group_key_type) {
 					rtl92e_set_swcam(dev, ipw->u.crypt.idx,
 							 ipw->u.crypt.idx,
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v3 6/8] staging: rtl8192e: Pass a pointer as an argument to sizeof() instead of struct
  2017-03-15  9:51         ` [PATCH v3 0/8] staging: rtl8192e: Fix coding style, warnings and checks sunil.m
                             ` (4 preceding siblings ...)
  2017-03-15  9:51           ` [PATCH v3 5/8] staging: rtl8192e: Fix unbalanced braces sunil.m
@ 2017-03-15  9:51           ` sunil.m
  2017-03-15  9:51           ` [PATCH v3 7/8] staging: rtl8192e: Fix issues reported by checkpatch.pl sunil.m
  2017-03-15  9:51           ` [PATCH v3 8/8] staging: rtl8192e: Fix blank lines and space after a cast sunil.m
  7 siblings, 0 replies; 40+ messages in thread
From: sunil.m @ 2017-03-15  9:51 UTC (permalink / raw)
  To: gregkh, dan.carpenter; +Cc: devel, linux-kernel, karthiknishu, Suniel Mahesh

From: Suniel Mahesh <sunil.m@techveda.org>

Replaced sizeof(struct foo) into sizeof(*ptr), found by checkpatch.pl

Signed-off-by: Suniel Mahesh <sunil.m@techveda.org>
---
Changes for v3:

- Split earlier patches into multiple commits for easy review
  as suggested by Greg K-H
- Modified description for better readability
- Rebased on top of next-20170310
- Patches were tested and built on next-20170310 and staging-testing
  as suggested by Greg K-H, no errors reported

Changes for v2:

- new patch addition to the series
- Rebased on top of next-20170306
---
 drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
index c355ee7..184d6ec 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
@@ -969,7 +969,7 @@ static void _rtl92e_init_priv_variable(struct net_device *dev)
 
 	priv->card_type = PCI;
 
-	priv->pFirmware = vzalloc(sizeof(struct rt_firmware));
+	priv->pFirmware = vzalloc(sizeof(*priv->pFirmware));
 	if (!priv->pFirmware)
 		return;
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v3 7/8] staging: rtl8192e: Fix issues reported by checkpatch.pl
  2017-03-15  9:51         ` [PATCH v3 0/8] staging: rtl8192e: Fix coding style, warnings and checks sunil.m
                             ` (5 preceding siblings ...)
  2017-03-15  9:51           ` [PATCH v3 6/8] staging: rtl8192e: Pass a pointer as an argument to sizeof() instead of struct sunil.m
@ 2017-03-15  9:51           ` sunil.m
  2017-03-15  9:51           ` [PATCH v3 8/8] staging: rtl8192e: Fix blank lines and space after a cast sunil.m
  7 siblings, 0 replies; 40+ messages in thread
From: sunil.m @ 2017-03-15  9:51 UTC (permalink / raw)
  To: gregkh, dan.carpenter; +Cc: devel, linux-kernel, karthiknishu, Suniel Mahesh

From: Suniel Mahesh <sunil.m@techveda.org>

Fixed the following checkpatch.pl checks:
spaces preferred around that 'operator', spacing provided
Logical continuations should be on the previous line, modified accordingly
Unnecessary parentheses around variables, removed
Please use a blank line after function/struct/union/enum declarations, used

Signed-off-by: Suniel Mahesh <sunil.m@techveda.org>
---
Changes for v3:

- Split earlier patches into multiple commits for easy review
  as suggested by Greg K-H
- New patch addition to the series
- Rebased on top of next-20170310
- Patches were tested and built on next-20170310 and staging-testing
  as suggested by Greg K-H, no errors reported

Changes for v2:
---
 drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 46 +++++++++++++++-------------
 1 file changed, 24 insertions(+), 22 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
index 184d6ec..bb156e3 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
@@ -341,7 +341,7 @@ static void _rtl92e_update_cap(struct net_device *dev, u16 cap)
 		}
 	}
 
-	if (net->mode & (IEEE_G|IEEE_N_24G)) {
+	if (net->mode & (IEEE_G | IEEE_N_24G)) {
 		u8	slot_time_val;
 		u8	CurSlotTime = priv->slot_time;
 
@@ -675,7 +675,7 @@ static u8 _rtl92e_get_supported_wireless_mode(struct net_device *dev)
 	case RF_8256:
 	case RF_6052:
 	case RF_PSEUDO_11N:
-		ret = (WIRELESS_MODE_N_24G|WIRELESS_MODE_G | WIRELESS_MODE_B);
+		ret = (WIRELESS_MODE_N_24G | WIRELESS_MODE_G | WIRELESS_MODE_B);
 		break;
 	case RF_8258:
 		ret = (WIRELESS_MODE_A | WIRELESS_MODE_N_5G);
@@ -737,7 +737,7 @@ static int _rtl92e_sta_up(struct net_device *dev, bool is_silent_reset)
 {
 	struct r8192_priv *priv = rtllib_priv(dev);
 	struct rt_pwr_save_ctrl *pPSC = (struct rt_pwr_save_ctrl *)
-					(&(priv->rtllib->PowerSaveControl));
+					(&priv->rtllib->PowerSaveControl);
 	bool init_status = true;
 
 	priv->bDriverIsGoingToUnload = false;
@@ -883,7 +883,7 @@ static void _rtl92e_init_priv_constant(struct net_device *dev)
 {
 	struct r8192_priv *priv = rtllib_priv(dev);
 	struct rt_pwr_save_ctrl *pPSC = (struct rt_pwr_save_ctrl *)
-					&(priv->rtllib->PowerSaveControl);
+					&priv->rtllib->PowerSaveControl;
 
 	pPSC->RegMaxLPSAwakeIntvl = 5;
 }
@@ -1009,9 +1009,9 @@ static void _rtl92e_init_priv_task(struct net_device *dev)
 			      (void *)_rtl92e_update_beacon, dev);
 	INIT_WORK_RSL(&priv->qos_activate, (void *)_rtl92e_qos_activate, dev);
 	INIT_DELAYED_WORK_RSL(&priv->rtllib->hw_wakeup_wq,
-			      (void *) rtl92e_hw_wakeup_wq, dev);
+			      (void *)rtl92e_hw_wakeup_wq, dev);
 	INIT_DELAYED_WORK_RSL(&priv->rtllib->hw_sleep_wq,
-			      (void *) rtl92e_hw_sleep_wq, dev);
+			      (void *)rtl92e_hw_sleep_wq, dev);
 	tasklet_init(&priv->irq_rx_tasklet,
 		     (void(*)(unsigned long))_rtl92e_irq_rx_tasklet,
 		     (unsigned long)priv);
@@ -1029,8 +1029,8 @@ static short _rtl92e_get_channel_map(struct net_device *dev)
 
 	struct r8192_priv *priv = rtllib_priv(dev);
 
-	if ((priv->rf_chip != RF_8225) && (priv->rf_chip != RF_8256)
-			&& (priv->rf_chip != RF_6052)) {
+	if ((priv->rf_chip != RF_8225) && (priv->rf_chip != RF_8256) &&
+						(priv->rf_chip != RF_6052)) {
 		netdev_err(dev, "%s: unknown rf chip, can't set channel map\n",
 			   __func__);
 		return -1;
@@ -1056,7 +1056,7 @@ static short _rtl92e_init(struct net_device *dev)
 {
 	struct r8192_priv *priv = rtllib_priv(dev);
 
-	memset(&(priv->stats), 0, sizeof(struct rt_stats));
+	memset(&priv->stats, 0, sizeof(struct rt_stats));
 
 	_rtl92e_init_priv_handler(dev);
 	_rtl92e_init_priv_constant(dev);
@@ -1071,7 +1071,7 @@ static short _rtl92e_init(struct net_device *dev)
 
 	setup_timer(&priv->watch_dog_timer,
 		    _rtl92e_watchdog_timer_cb,
-		    (unsigned long) dev);
+		    (unsigned long)dev);
 
 	setup_timer(&priv->gpio_polling_timer,
 		    rtl92e_check_rfctrl_gpio_timer,
@@ -1126,7 +1126,7 @@ static enum reset_type _rtl92e_tx_check_stuck(struct net_device *dev)
 	switch (priv->rtllib->ps) {
 	case RTLLIB_PS_DISABLED:
 		break;
-	case (RTLLIB_PS_MBCAST|RTLLIB_PS_UNICAST):
+	case (RTLLIB_PS_MBCAST | RTLLIB_PS_UNICAST):
 		break;
 	default:
 		break;
@@ -1379,7 +1379,7 @@ static void _rtl92e_watchdog_wq_cb(void *data)
 	static u8 check_reset_cnt;
 	unsigned long flags;
 	struct rt_pwr_save_ctrl *pPSC = (struct rt_pwr_save_ctrl *)
-					(&(priv->rtllib->PowerSaveControl));
+					(&priv->rtllib->PowerSaveControl);
 	bool bBusyTraffic = false;
 	bool	bHigherBusyTraffic = false;
 	bool	bHigherBusyRxTraffic = false;
@@ -1461,7 +1461,7 @@ static void _rtl92e_watchdog_wq_cb(void *data)
 
 		_rtl92e_update_rxcounts(priv, &TotalRxBcnNum, &TotalRxDataNum);
 
-		if ((TotalRxBcnNum+TotalRxDataNum) == 0)
+		if ((TotalRxBcnNum + TotalRxDataNum) == 0)
 			priv->check_roaming_cnt++;
 		else
 			priv->check_roaming_cnt = 0;
@@ -1489,7 +1489,7 @@ static void _rtl92e_watchdog_wq_cb(void *data)
 			notify_wx_assoc_event(ieee);
 
 			if (!(ieee->rtllib_ap_sec_type(ieee) &
-			     (SEC_ALG_CCMP|SEC_ALG_TKIP)))
+			     (SEC_ALG_CCMP | SEC_ALG_TKIP)))
 				schedule_delayed_work(
 					&ieee->associate_procedure_wq, 0);
 
@@ -1593,7 +1593,7 @@ static void _rtl92e_free_tx_ring(struct net_device *dev, unsigned int prio)
 		ring->idx = (ring->idx + 1) % ring->entries;
 	}
 
-	pci_free_consistent(priv->pdev, sizeof(*ring->desc)*ring->entries,
+	pci_free_consistent(priv->pdev, sizeof(*ring->desc) * ring->entries,
 	ring->desc, ring->dma);
 	ring->desc = NULL;
 }
@@ -1702,7 +1702,7 @@ static void _rtl92e_tx_cmd(struct net_device *dev, struct sk_buff *skb)
 	ring = &priv->tx_ring[TXCMD_QUEUE];
 
 	idx = (ring->idx + skb_queue_len(&ring->queue)) % ring->entries;
-	entry = (struct tx_desc_cmd *) &ring->desc[idx];
+	entry = (struct tx_desc_cmd *)&ring->desc[idx];
 
 	tcb_desc = (struct cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE);
 
@@ -2022,7 +2022,7 @@ static void _rtl92e_rx_normal(struct net_device *dev)
 
 	struct rtllib_rx_stats stats = {
 		.signal = 0,
-		.noise = (u8) -98,
+		.noise = (u8)-98,
 		.rate = 0,
 		.freq = RTLLIB_24GHZ_BAND,
 	};
@@ -2095,7 +2095,7 @@ static void _rtl92e_rx_normal(struct net_device *dev)
 
 		priv->rx_buf[rx_queue_idx][priv->rx_idx[rx_queue_idx]] =
 								 skb;
-		*((dma_addr_t *) skb->cb) = pci_map_single(priv->pdev,
+		*((dma_addr_t *)skb->cb) = pci_map_single(priv->pdev,
 					    skb_tail_pointer_rsl(skb),
 					    priv->rxbuffersize,
 					    PCI_DMA_FROMDEVICE);
@@ -2108,7 +2108,7 @@ static void _rtl92e_rx_normal(struct net_device *dev)
 		pdesc->BufferAddress = *((dma_addr_t *)skb->cb);
 		pdesc->OWN = 1;
 		pdesc->Length = priv->rxbuffersize;
-		if (priv->rx_idx[rx_queue_idx] == priv->rxringcount-1)
+		if (priv->rx_idx[rx_queue_idx] == priv->rxringcount - 1)
 			pdesc->EOR = 1;
 		priv->rx_idx[rx_queue_idx] = (priv->rx_idx[rx_queue_idx] + 1) %
 					      priv->rxringcount;
@@ -2342,8 +2342,9 @@ static int _rtl92e_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 									0, key);
 					}
 				}
-				if ((ieee->pairwise_key_type == KEY_TYPE_CCMP)
-				     && ieee->pHTInfo->bCurrentHTSupport) {
+				if ((ieee->pairwise_key_type ==
+				     KEY_TYPE_CCMP) &&
+				     ieee->pHTInfo->bCurrentHTSupport) {
 					rtl92e_writeb(dev, 0x173, 1);
 				}
 
@@ -2719,7 +2720,7 @@ bool rtl92e_enable_nic(struct net_device *dev)
 	bool init_status = true;
 	struct r8192_priv *priv = rtllib_priv(dev);
 	struct rt_pwr_save_ctrl *pPSC = (struct rt_pwr_save_ctrl *)
-					(&(priv->rtllib->PowerSaveControl));
+					(&priv->rtllib->PowerSaveControl);
 
 	if (!priv->up) {
 		netdev_warn(dev, "%s(): Driver is already down!\n", __func__);
@@ -2744,6 +2745,7 @@ bool rtl92e_enable_nic(struct net_device *dev)
 	RT_TRACE(COMP_PS, "<===========%s()\n", __func__);
 	return init_status;
 }
+
 bool rtl92e_disable_nic(struct net_device *dev)
 {
 	struct r8192_priv *priv = rtllib_priv(dev);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v3 8/8] staging: rtl8192e: Fix blank lines and space after a cast
  2017-03-15  9:51         ` [PATCH v3 0/8] staging: rtl8192e: Fix coding style, warnings and checks sunil.m
                             ` (6 preceding siblings ...)
  2017-03-15  9:51           ` [PATCH v3 7/8] staging: rtl8192e: Fix issues reported by checkpatch.pl sunil.m
@ 2017-03-15  9:51           ` sunil.m
  7 siblings, 0 replies; 40+ messages in thread
From: sunil.m @ 2017-03-15  9:51 UTC (permalink / raw)
  To: gregkh, dan.carpenter; +Cc: devel, linux-kernel, karthiknishu, Suniel Mahesh

From: Suniel Mahesh <sunil.m@techveda.org>

Fixed the following checkpatch.pl checks:
Blank lines aren't necessary after an open brace '{'
and before a close brace '}', removed
No space is necessary after a cast, removed
Please don't use multiple blank lines, removed

Signed-off-by: Suniel Mahesh <sunil.m@techveda.org>
---
Changes for v3:

- Split earlier patches into multiple commits for easy review
  as suggested by Greg K-H
- New patch addition to the series
- Rebased on top of next-20170310
- Patches were tested and built on next-20170310 and staging-testing
  as suggested by Greg K-H, no errors reported

Changes for v2:
---
 drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 26 --------------------------
 1 file changed, 26 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
index bb156e3..a587069 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
@@ -37,7 +37,6 @@
 static int channels = 0x3fff;
 static char *ifname = "wlan%d";
 
-
 static const struct rtl819x_ops rtl819xp_ops = {
 	.nic_type			= NIC_8192E,
 	.get_eeprom_size		= rtl92e_get_eeprom_size,
@@ -195,7 +194,6 @@ bool rtl92e_set_rf_state(struct net_device *dev,
 			priv->rtllib->RfOffReason = 0;
 			bActionAllowed = true;
 
-
 			if (rtState == eRfOff &&
 			    ChangeSource >= RF_CHANGE_BY_HW)
 				bConnectBySSID = true;
@@ -242,7 +240,6 @@ bool rtl92e_set_rf_state(struct net_device *dev,
 			 StateToSet, priv->rtllib->RfOffReason);
 		PHY_SetRFPowerState(dev, StateToSet);
 		if (StateToSet == eRfOn) {
-
 			if (bConnectBySSID && priv->blinked_ingpio) {
 				schedule_delayed_work(
 					 &ieee->associate_procedure_wq, 0);
@@ -401,8 +398,6 @@ static void _rtl92e_qos_activate(void *data)
 
 	for (i = 0; i <  QOS_QUEUE_NUM; i++)
 		priv->rtllib->SetHwRegHandler(dev, HW_VAR_AC_PARAM, (u8 *)(&i));
-
-
 success:
 	mutex_unlock(&priv->mutex);
 }
@@ -462,7 +457,6 @@ static int _rtl92e_handle_beacon(struct net_device *dev,
 
 	schedule_delayed_work(&priv->update_beacon_wq, 0);
 	return 0;
-
 }
 
 static int _rtl92e_qos_assoc_resp(struct r8192_priv *priv,
@@ -888,7 +882,6 @@ static void _rtl92e_init_priv_constant(struct net_device *dev)
 	pPSC->RegMaxLPSAwakeIntvl = 5;
 }
 
-
 static void _rtl92e_init_priv_variable(struct net_device *dev)
 {
 	struct r8192_priv *priv = rtllib_priv(dev);
@@ -1211,7 +1204,6 @@ static enum reset_type _rtl92e_if_check_reset(struct net_device *dev)
 	} else {
 		return RESET_TYPE_NORESET;
 	}
-
 }
 
 static void _rtl92e_if_silent_reset(struct net_device *dev)
@@ -1223,7 +1215,6 @@ static void _rtl92e_if_silent_reset(struct net_device *dev)
 	unsigned long flag;
 
 	if (priv->ResetProgress == RESET_TYPE_NORESET) {
-
 		RT_TRACE(COMP_RESET, "=========>Reset progress!!\n");
 
 		priv->ResetProgress = RESET_TYPE_SILENT;
@@ -1417,7 +1408,6 @@ static void _rtl92e_watchdog_wq_cb(void *data)
 		ieee->LinkDetectInfo.NumTxOkInPeriod > 100)
 			bBusyTraffic = true;
 
-
 		if (ieee->LinkDetectInfo.NumRxOkInPeriod > 4000 ||
 		    ieee->LinkDetectInfo.NumTxOkInPeriod > 4000) {
 			bHigherBusyTraffic = true;
@@ -1466,7 +1456,6 @@ static void _rtl92e_watchdog_wq_cb(void *data)
 		else
 			priv->check_roaming_cnt = 0;
 
-
 		if (priv->check_roaming_cnt > 0) {
 			if (ieee->eRFPowerState == eRfOff)
 				netdev_info(dev, "%s(): RF is off\n", __func__);
@@ -1497,7 +1486,6 @@ static void _rtl92e_watchdog_wq_cb(void *data)
 		}
 		ieee->LinkDetectInfo.NumRecvBcnInPeriod = 0;
 		ieee->LinkDetectInfo.NumRecvDataInPeriod = 0;
-
 	}
 
 	spin_lock_irqsave(&priv->tx_lock, flags);
@@ -1549,7 +1537,6 @@ void rtl92e_tx_enable(struct net_device *dev)
 	rtllib_reset_queue(priv->rtllib);
 }
 
-
 static void _rtl92e_free_rx_ring(struct net_device *dev)
 {
 	struct r8192_priv *priv = rtllib_priv(dev);
@@ -1951,13 +1938,11 @@ long rtl92e_translate_to_dbm(struct r8192_priv *priv, u8 signal_strength_index)
 	return signal_power;
 }
 
-
 void rtl92e_update_rx_statistics(struct r8192_priv *priv,
 				 struct rtllib_rx_stats *pprevious_stats)
 {
 	int weighting = 0;
 
-
 	if (priv->stats.recv_signal_power == 0)
 		priv->stats.recv_signal_power =
 					 pprevious_stats->RecvSignalPower;
@@ -1981,7 +1966,6 @@ u8 rtl92e_rx_db_to_percent(s8 antpower)
 		return	100;
 	else
 		return	100 + antpower;
-
 }
 
 u8 rtl92e_evm_db_to_percent(s8 value)
@@ -2008,8 +1992,6 @@ void rtl92e_copy_mpdu_stats(struct rtllib_rx_stats *psrc_stats,
 	ptarget_stats->bFirstMPDU = psrc_stats->bFirstMPDU;
 }
 
-
-
 static void _rtl92e_rx_normal(struct net_device *dev)
 {
 	struct r8192_priv *priv = rtllib_priv(dev);
@@ -2113,7 +2095,6 @@ static void _rtl92e_rx_normal(struct net_device *dev)
 		priv->rx_idx[rx_queue_idx] = (priv->rx_idx[rx_queue_idx] + 1) %
 					      priv->rxringcount;
 	}
-
 }
 
 static void _rtl92e_tx_resume(struct net_device *dev)
@@ -2172,7 +2153,6 @@ static int _rtl92e_open(struct net_device *dev)
 	ret = _rtl92e_try_up(dev);
 	mutex_unlock(&priv->wx_mutex);
 	return ret;
-
 }
 
 static int _rtl92e_try_up(struct net_device *dev)
@@ -2184,7 +2164,6 @@ static int _rtl92e_try_up(struct net_device *dev)
 	return _rtl92e_up(dev, false);
 }
 
-
 static int _rtl92e_close(struct net_device *dev)
 {
 	struct r8192_priv *priv = rtllib_priv(dev);
@@ -2202,7 +2181,6 @@ static int _rtl92e_close(struct net_device *dev)
 	mutex_unlock(&priv->wx_mutex);
 
 	return ret;
-
 }
 
 static int _rtl92e_down(struct net_device *dev, bool shutdownrf)
@@ -2245,10 +2223,8 @@ static void _rtl92e_set_multicast(struct net_device *dev)
 
 	promisc = (dev->flags & IFF_PROMISC) ? 1 : 0;
 	priv->promisc = promisc;
-
 }
 
-
 static int _rtl92e_set_mac_adr(struct net_device *dev, void *mac)
 {
 	struct r8192_priv *priv = rtllib_priv(dev);
@@ -2396,7 +2372,6 @@ static int _rtl92e_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 	return ret;
 }
 
-
 static irqreturn_t _rtl92e_irq(int irq, void *netdev)
 {
 	struct net_device *dev = netdev;
@@ -2603,7 +2578,6 @@ static int _rtl92e_pci_probe(struct pci_dev *pdev,
 		goto err_rel_rtllib;
 	}
 
-
 	ioaddr = (unsigned long)ioremap_nocache(pmem_start, pmem_len);
 	if (ioaddr == (unsigned long)NULL) {
 		netdev_err(dev, "ioremap failed!");
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 40+ messages in thread

* Re: [PATCH v3 2/8] staging: rtl8192e: Fix coding style
  2017-03-15  9:51           ` [PATCH v3 2/8] staging: rtl8192e: Fix " sunil.m
@ 2017-03-15 10:14             ` Dan Carpenter
  2017-03-15 11:09               ` Suniel Mahesh
  2017-03-15 10:15             ` Dan Carpenter
  1 sibling, 1 reply; 40+ messages in thread
From: Dan Carpenter @ 2017-03-15 10:14 UTC (permalink / raw)
  To: sunil.m; +Cc: gregkh, devel, karthiknishu, linux-kernel

On Wed, Mar 15, 2017 at 03:21:51PM +0530, sunil.m@techveda.org wrote:
> @@ -1796,7 +1796,7 @@ static short _rtl92e_alloc_rx_ring(struct net_device *dev)
>  
>  	for (rx_queue_idx = 0; rx_queue_idx < MAX_RX_QUEUE; rx_queue_idx++) {
>  		priv->rx_ring[rx_queue_idx] = pci_zalloc_consistent(priv->pdev,
> -					      sizeof(*priv->rx_ring[rx_queue_idx]) * priv->rxringcount,
> +		sizeof(*priv->rx_ring[rx_queue_idx]) * priv->rxringcount,
>  					      &priv->rx_ring_dma[rx_queue_idx]);

No, don't do that.  The original was easier to read.  Ignore
checkpatch.pl if it gives you bad advice.

>  		if (!priv->rx_ring[rx_queue_idx] ||
>  		    (unsigned long)priv->rx_ring[rx_queue_idx] & 0xFF) {
> @@ -2272,7 +2272,8 @@ static int _rtl92e_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
>  	int ret = -1;
>  	struct rtllib_device *ieee = priv->rtllib;
>  	u32 key[4];
> -	const u8 broadcast_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
> +	const u8 broadcast_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff,
> +									0xff};

Just drop this patch...  The original is better.

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PATCH v3 2/8] staging: rtl8192e: Fix coding style
  2017-03-15  9:51           ` [PATCH v3 2/8] staging: rtl8192e: Fix " sunil.m
  2017-03-15 10:14             ` Dan Carpenter
@ 2017-03-15 10:15             ` Dan Carpenter
  1 sibling, 0 replies; 40+ messages in thread
From: Dan Carpenter @ 2017-03-15 10:15 UTC (permalink / raw)
  To: sunil.m; +Cc: gregkh, devel, linux-kernel, karthiknishu

Also the subject is too vague.

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PATCH v3 3/8] staging: rtl8192e: Remove unnecessary 'out of memory' message
  2017-03-15  9:51           ` [PATCH v3 3/8] staging: rtl8192e: Remove unnecessary 'out of memory' message sunil.m
@ 2017-03-15 10:16             ` Dan Carpenter
  2017-03-15 10:58               ` [PATCH v4 " sunil.m
  0 siblings, 1 reply; 40+ messages in thread
From: Dan Carpenter @ 2017-03-15 10:16 UTC (permalink / raw)
  To: sunil.m; +Cc: gregkh, devel, karthiknishu, linux-kernel

On Wed, Mar 15, 2017 at 03:21:52PM +0530, sunil.m@techveda.org wrote:
> From: Suniel Mahesh <sunil.m@techveda.org>
> 
> Fixed the following checkpatch.pl warning:
> Possible unnecessary 'out of memory' message
> 
> Signed-off-by: Suniel Mahesh <sunil.m@techveda.org>
> ---
> Changes for v3:
> 
> - Split earlier patches into multiple commits for easy review
>   as suggested by Greg K-H
> - Modified subject and description for better readability
> - Rebased on top of next-20170310
> - Patches were tested and built on next-20170310 and staging-testing
>   as suggested by Greg K-H, no errors reported
> 
> Changes for v2:
> 
> - Improve error handling reported by checkpatch.pl in rtl_core.c
> - new patch addition to the series
> - Rebased on top of next-20170306
> ---
>  drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
> index eb2321c..37a03ca 100644
> --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
> +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
> @@ -971,8 +971,8 @@ static void _rtl92e_init_priv_variable(struct net_device *dev)
>  
>  	priv->pFirmware = vzalloc(sizeof(struct rt_firmware));
>  	if (!priv->pFirmware)
> -		netdev_err(dev,
> -			   "rtl8192e: Unable to allocate space for firmware\n");
> +		return;

The patch description doesn't mention this return.

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PATCH v3 5/8] staging: rtl8192e: Fix unbalanced braces
  2017-03-15  9:51           ` [PATCH v3 5/8] staging: rtl8192e: Fix unbalanced braces sunil.m
@ 2017-03-15 10:24             ` Dan Carpenter
  0 siblings, 0 replies; 40+ messages in thread
From: Dan Carpenter @ 2017-03-15 10:24 UTC (permalink / raw)
  To: sunil.m; +Cc: gregkh, devel, linux-kernel, karthiknishu

On Wed, Mar 15, 2017 at 03:21:54PM +0530, sunil.m@techveda.org wrote:
> @@ -2294,17 +2294,20 @@ static int _rtl92e_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
>  
>  		if (ipw->cmd == IEEE_CMD_SET_ENCRYPTION) {
>  			if (ipw->u.crypt.set_tx) {
> -				if (strcmp(ipw->u.crypt.alg, "CCMP") == 0)
> +				if (strcmp(ipw->u.crypt.alg, "CCMP") == 0) {
>  					ieee->pairwise_key_type = KEY_TYPE_CCMP;
> -				else if (strcmp(ipw->u.crypt.alg, "TKIP") == 0)
> +				} else if (strcmp(ipw->u.crypt.alg,
> +								"TKIP") == 0) {

This is higgledy piggledy.  The original was better.

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 40+ messages in thread

* [PATCH v4 3/8] staging: rtl8192e: Remove unnecessary 'out of memory' message
  2017-03-15 10:16             ` Dan Carpenter
@ 2017-03-15 10:58               ` sunil.m
  2017-03-16  2:36                 ` Greg KH
  0 siblings, 1 reply; 40+ messages in thread
From: sunil.m @ 2017-03-15 10:58 UTC (permalink / raw)
  To: gregkh, dan.carpenter; +Cc: devel, linux-kernel, karthiknishu, Suniel Mahesh

From: Suniel Mahesh <sunil.m@techveda.org>

Fixed the following checkpatch.pl warning:
Possible unnecessary 'out of memory' message
If it is out of memory, function should return with an
appropriate error code. Since this function is of type void,
a return statement is used.

Signed-off-by: Suniel Mahesh <sunil.m@techveda.org>
---
Changes for v4:

- Modified description for better readability as pointed out by
  Dan Carpenter

Changes for v3:

- Split earlier patches into multiple commits for easy review
  as suggested by Greg K-H
- Modified subject and description for better readability
- Rebased on top of next-20170310
- Patches were tested and built on next-20170310 and staging-testing
  as suggested by Greg K-H, no errors reported

Changes for v2:

- Improve error handling reported by checkpatch.pl in rtl_core.c
- new patch addition to the series
- Rebased on top of next-20170306
---
 drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
index eb2321c..37a03ca 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
@@ -971,8 +971,8 @@ static void _rtl92e_init_priv_variable(struct net_device *dev)
 
 	priv->pFirmware = vzalloc(sizeof(struct rt_firmware));
 	if (!priv->pFirmware)
-		netdev_err(dev,
-			   "rtl8192e: Unable to allocate space for firmware\n");
+		return;
+
 	skb_queue_head_init(&priv->skb_queue);
 
 	for (i = 0; i < MAX_QUEUE_SIZE; i++)
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 40+ messages in thread

* Re: [PATCH v3 2/8] staging: rtl8192e: Fix coding style
  2017-03-15 10:14             ` Dan Carpenter
@ 2017-03-15 11:09               ` Suniel Mahesh
  2017-03-15 11:15                 ` Dan Carpenter
  0 siblings, 1 reply; 40+ messages in thread
From: Suniel Mahesh @ 2017-03-15 11:09 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: gregkh, devel, karthiknishu, linux-kernel

On Wednesday 15 March 2017 03:44 PM, Dan Carpenter wrote:
> On Wed, Mar 15, 2017 at 03:21:51PM +0530, sunil.m@techveda.org wrote:
>> @@ -1796,7 +1796,7 @@ static short _rtl92e_alloc_rx_ring(struct net_device *dev)
>>
>>  	for (rx_queue_idx = 0; rx_queue_idx < MAX_RX_QUEUE; rx_queue_idx++) {
>>  		priv->rx_ring[rx_queue_idx] = pci_zalloc_consistent(priv->pdev,
>> -					      sizeof(*priv->rx_ring[rx_queue_idx]) * priv->rxringcount,
>> +		sizeof(*priv->rx_ring[rx_queue_idx]) * priv->rxringcount,
>>  					      &priv->rx_ring_dma[rx_queue_idx]);
>
> No, don't do that.  The original was easier to read.  Ignore
> checkpatch.pl if it gives you bad advice.
>
>>  		if (!priv->rx_ring[rx_queue_idx] ||
>>  		    (unsigned long)priv->rx_ring[rx_queue_idx] & 0xFF) {
>> @@ -2272,7 +2272,8 @@ static int _rtl92e_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
>>  	int ret = -1;
>>  	struct rtllib_device *ieee = priv->rtllib;
>>  	u32 key[4];
>> -	const u8 broadcast_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
>> +	const u8 broadcast_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff,
>> +									0xff};
>
> Just drop this patch...  The original is better.
>
> regards,
> dan carpenter
>
hi, when you say drop this patch, should I send the entire patch set as 
PATCH v4 with this particular patch dropped ?

regards
suniel

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PATCH v3 2/8] staging: rtl8192e: Fix coding style
  2017-03-15 11:09               ` Suniel Mahesh
@ 2017-03-15 11:15                 ` Dan Carpenter
  0 siblings, 0 replies; 40+ messages in thread
From: Dan Carpenter @ 2017-03-15 11:15 UTC (permalink / raw)
  To: Suniel Mahesh; +Cc: devel, gregkh, karthiknishu, linux-kernel

On Wed, Mar 15, 2017 at 04:39:20PM +0530, Suniel Mahesh wrote:
> On Wednesday 15 March 2017 03:44 PM, Dan Carpenter wrote:
> >On Wed, Mar 15, 2017 at 03:21:51PM +0530, sunil.m@techveda.org wrote:
> >>@@ -1796,7 +1796,7 @@ static short _rtl92e_alloc_rx_ring(struct net_device *dev)
> >>
> >> 	for (rx_queue_idx = 0; rx_queue_idx < MAX_RX_QUEUE; rx_queue_idx++) {
> >> 		priv->rx_ring[rx_queue_idx] = pci_zalloc_consistent(priv->pdev,
> >>-					      sizeof(*priv->rx_ring[rx_queue_idx]) * priv->rxringcount,
> >>+		sizeof(*priv->rx_ring[rx_queue_idx]) * priv->rxringcount,
> >> 					      &priv->rx_ring_dma[rx_queue_idx]);
> >
> >No, don't do that.  The original was easier to read.  Ignore
> >checkpatch.pl if it gives you bad advice.
> >
> >> 		if (!priv->rx_ring[rx_queue_idx] ||
> >> 		    (unsigned long)priv->rx_ring[rx_queue_idx] & 0xFF) {
> >>@@ -2272,7 +2272,8 @@ static int _rtl92e_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
> >> 	int ret = -1;
> >> 	struct rtllib_device *ieee = priv->rtllib;
> >> 	u32 key[4];
> >>-	const u8 broadcast_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
> >>+	const u8 broadcast_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff,
> >>+									0xff};
> >
> >Just drop this patch...  The original is better.
> >
> >regards,
> >dan carpenter
> >
> hi, when you say drop this patch, should I send the entire patch set
> as PATCH v4 with this particular patch dropped ?


Just drop [PATCH 2/8]...  Hopefully you can see why the original was
more readable?  We don't really care about checkpatch.pl except as a
tool to make the code more readable to human beings.

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PATCH v4 3/8] staging: rtl8192e: Remove unnecessary 'out of memory' message
  2017-03-15 10:58               ` [PATCH v4 " sunil.m
@ 2017-03-16  2:36                 ` Greg KH
  2017-03-16 22:12                   ` [PATCH v4 0/6] staging: rtl8192e: Fix coding style, warnings and checks sunil.m
  0 siblings, 1 reply; 40+ messages in thread
From: Greg KH @ 2017-03-16  2:36 UTC (permalink / raw)
  To: sunil.m; +Cc: dan.carpenter, devel, karthiknishu, linux-kernel

On Wed, Mar 15, 2017 at 04:28:09PM +0530, sunil.m@techveda.org wrote:
> From: Suniel Mahesh <sunil.m@techveda.org>
> 
> Fixed the following checkpatch.pl warning:
> Possible unnecessary 'out of memory' message
> If it is out of memory, function should return with an
> appropriate error code. Since this function is of type void,
> a return statement is used.
> 
> Signed-off-by: Suniel Mahesh <sunil.m@techveda.org>
> ---
> Changes for v4:
> 
> - Modified description for better readability as pointed out by
>   Dan Carpenter

Please resend the whole series, not just individual patches, otherwise
it is impossible for me to keep track of what the latest patches are to
be applied.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 40+ messages in thread

* [PATCH v4 0/6] staging: rtl8192e: Fix coding style, warnings and checks
  2017-03-16  2:36                 ` Greg KH
@ 2017-03-16 22:12                   ` sunil.m
  2017-03-16 22:12                     ` [PATCH v4 4/6] staging: rtl8192e: Pass a pointer as an argument to sizeof() instead of struct sunil.m
                                       ` (2 more replies)
  0 siblings, 3 replies; 40+ messages in thread
From: sunil.m @ 2017-03-16 22:12 UTC (permalink / raw)
  To: gregkh, dan.carpenter; +Cc: devel, linux-kernel, karthiknishu, Suniel Mahesh

From: Suniel Mahesh <sunil.m@techveda.org>

Split earlier patches into multiple commits for easy review as
suggested by Dan Carpenter.
Modified subject, description and in few patches both for
better readability as suggested by Greg KH.
Dropped two patches from the earler series, as they were not adding 
significant value, suggested by Dan Carpenter.
Fixed the following issues reported by checkpatch.pl:
Block comments should align the * on each line, aligned.
Block comments use * on subsequent lines, other characters
are replaced by * .
Removed unnecessary 'out of memory' message.
Comparison's to NULL could be written '!foo' or 'foo', modified.
Replaced sizeof(struct foo) into sizeof(*ptr).
Spaces preferred around that 'operator', spacing provided.
Logical continuations should be on the previous line, modified accordingly.
Unnecessary parentheses around variables, removed.
Please use a blank line after function/struct/union/enum declarations, used.
Blank lines aren't necessary after an open brace '{' and before a
close brace '}', removed.
No space is necessary after a cast, removed.
Please don't use multiple blank lines, removed.

Rebased on top of next-20170310.
Patches were tested and built on next-20170310 and staging-testing
as suggested by Greg K-H, no errors reported.

Suniel Mahesh (6):
  staging: rtl8192e: Fix comments as per kernel coding style
  staging: rtl8192e: Remove unnecessary 'out of memory' message
  staging: rtl8192e: Rectify pointer comparisions with NULL
  staging: rtl8192e: Pass a pointer as an argument to sizeof() instead
    of struct
  staging: rtl8192e: Fix issues reported by checkpatch.pl
  staging: rtl8192e: Fix blank lines and space after a cast

 drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 141 ++++++++++-----------------
 1 file changed, 50 insertions(+), 91 deletions(-)

-- 
1.9.1

^ permalink raw reply	[flat|nested] 40+ messages in thread

* [PATCH v4 4/6] staging: rtl8192e: Pass a pointer as an argument to sizeof() instead of struct
  2017-03-16 22:12                   ` [PATCH v4 0/6] staging: rtl8192e: Fix coding style, warnings and checks sunil.m
@ 2017-03-16 22:12                     ` sunil.m
  2017-03-16 22:12                     ` [PATCH v4 6/6] staging: rtl8192e: Fix blank lines and space after a cast sunil.m
  2017-03-17  6:16                     ` [PATCH v4 0/6] staging: rtl8192e: Fix coding style, warnings and checks Greg KH
  2 siblings, 0 replies; 40+ messages in thread
From: sunil.m @ 2017-03-16 22:12 UTC (permalink / raw)
  To: gregkh, dan.carpenter; +Cc: devel, linux-kernel, karthiknishu, Suniel Mahesh

From: Suniel Mahesh <sunil.m@techveda.org>

Replaced sizeof(struct foo) into sizeof(*ptr), found by checkpatch.pl

Signed-off-by: Suniel Mahesh <sunil.m@techveda.org>
---
Changes for v4:

- Dropped two patches from the series, as they were not adding significant value
  suggested by Dan Carpenter.
  staging: rtl8192e: Fix coding style, this was fixing line over 80 characters.
  staging: rtl8192e: Fix unbalanced braces
- Resending the whole series as requested by Greg K-H
- Patches were tested and built on next-20170310 and staging-testing

Changes for v3:

- Split earlier patches into multiple commits for easy review
  as suggested by Greg K-H
- Modified description for better readability
- Rebased on top of next-20170310
- Patches were tested and built on next-20170310 and staging-testing
  as suggested by Greg K-H, no errors reported

Changes for v2:

- new patch addition to the series
- Rebased on top of next-20170306
---
 drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
index 4f4cd07..999af05 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
@@ -969,7 +969,7 @@ static void _rtl92e_init_priv_variable(struct net_device *dev)
 
 	priv->card_type = PCI;
 
-	priv->pFirmware = vzalloc(sizeof(struct rt_firmware));
+	priv->pFirmware = vzalloc(sizeof(*priv->pFirmware));
 	if (!priv->pFirmware)
 		return;
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v4 6/6] staging: rtl8192e: Fix blank lines and space after a cast
  2017-03-16 22:12                   ` [PATCH v4 0/6] staging: rtl8192e: Fix coding style, warnings and checks sunil.m
  2017-03-16 22:12                     ` [PATCH v4 4/6] staging: rtl8192e: Pass a pointer as an argument to sizeof() instead of struct sunil.m
@ 2017-03-16 22:12                     ` sunil.m
  2017-03-17  6:16                     ` [PATCH v4 0/6] staging: rtl8192e: Fix coding style, warnings and checks Greg KH
  2 siblings, 0 replies; 40+ messages in thread
From: sunil.m @ 2017-03-16 22:12 UTC (permalink / raw)
  To: gregkh, dan.carpenter; +Cc: devel, linux-kernel, karthiknishu, Suniel Mahesh

From: Suniel Mahesh <sunil.m@techveda.org>

Fixed the following checkpatch.pl checks:
Blank lines aren't necessary after an open brace '{'
and before a close brace '}', removed
No space is necessary after a cast, removed
Please don't use multiple blank lines, removed

Signed-off-by: Suniel Mahesh <sunil.m@techveda.org>
---
Changes for v4:

- Dropped two patches from the series, as they were not adding significant value
  suggested by Dan Carpenter.
  staging: rtl8192e: Fix coding style, this was fixing line over 80 characters.
  staging: rtl8192e: Fix unbalanced braces
- Resending the whole series as requested by Greg K-H
- Patches were tested and built on next-20170310 and staging-testing

Changes for v3:

- Split earlier patches into multiple commits for easy review
  as suggested by Greg K-H
- New patch addition to the series
- Rebased on top of next-20170310
- Patches were tested and built on next-20170310 and staging-testing
  as suggested by Greg K-H, no errors reported

Changes for v2:
---
 drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 26 --------------------------
 1 file changed, 26 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
index 1d22f18..bc2c732 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
@@ -37,7 +37,6 @@
 static int channels = 0x3fff;
 static char *ifname = "wlan%d";
 
-
 static const struct rtl819x_ops rtl819xp_ops = {
 	.nic_type			= NIC_8192E,
 	.get_eeprom_size		= rtl92e_get_eeprom_size,
@@ -195,7 +194,6 @@ bool rtl92e_set_rf_state(struct net_device *dev,
 			priv->rtllib->RfOffReason = 0;
 			bActionAllowed = true;
 
-
 			if (rtState == eRfOff &&
 			    ChangeSource >= RF_CHANGE_BY_HW)
 				bConnectBySSID = true;
@@ -242,7 +240,6 @@ bool rtl92e_set_rf_state(struct net_device *dev,
 			 StateToSet, priv->rtllib->RfOffReason);
 		PHY_SetRFPowerState(dev, StateToSet);
 		if (StateToSet == eRfOn) {
-
 			if (bConnectBySSID && priv->blinked_ingpio) {
 				schedule_delayed_work(
 					 &ieee->associate_procedure_wq, 0);
@@ -401,8 +398,6 @@ static void _rtl92e_qos_activate(void *data)
 
 	for (i = 0; i <  QOS_QUEUE_NUM; i++)
 		priv->rtllib->SetHwRegHandler(dev, HW_VAR_AC_PARAM, (u8 *)(&i));
-
-
 success:
 	mutex_unlock(&priv->mutex);
 }
@@ -462,7 +457,6 @@ static int _rtl92e_handle_beacon(struct net_device *dev,
 
 	schedule_delayed_work(&priv->update_beacon_wq, 0);
 	return 0;
-
 }
 
 static int _rtl92e_qos_assoc_resp(struct r8192_priv *priv,
@@ -888,7 +882,6 @@ static void _rtl92e_init_priv_constant(struct net_device *dev)
 	pPSC->RegMaxLPSAwakeIntvl = 5;
 }
 
-
 static void _rtl92e_init_priv_variable(struct net_device *dev)
 {
 	struct r8192_priv *priv = rtllib_priv(dev);
@@ -1211,7 +1204,6 @@ static enum reset_type _rtl92e_if_check_reset(struct net_device *dev)
 	} else {
 		return RESET_TYPE_NORESET;
 	}
-
 }
 
 static void _rtl92e_if_silent_reset(struct net_device *dev)
@@ -1223,7 +1215,6 @@ static void _rtl92e_if_silent_reset(struct net_device *dev)
 	unsigned long flag;
 
 	if (priv->ResetProgress == RESET_TYPE_NORESET) {
-
 		RT_TRACE(COMP_RESET, "=========>Reset progress!!\n");
 
 		priv->ResetProgress = RESET_TYPE_SILENT;
@@ -1417,7 +1408,6 @@ static void _rtl92e_watchdog_wq_cb(void *data)
 		ieee->LinkDetectInfo.NumTxOkInPeriod > 100)
 			bBusyTraffic = true;
 
-
 		if (ieee->LinkDetectInfo.NumRxOkInPeriod > 4000 ||
 		    ieee->LinkDetectInfo.NumTxOkInPeriod > 4000) {
 			bHigherBusyTraffic = true;
@@ -1466,7 +1456,6 @@ static void _rtl92e_watchdog_wq_cb(void *data)
 		else
 			priv->check_roaming_cnt = 0;
 
-
 		if (priv->check_roaming_cnt > 0) {
 			if (ieee->eRFPowerState == eRfOff)
 				netdev_info(dev, "%s(): RF is off\n", __func__);
@@ -1497,7 +1486,6 @@ static void _rtl92e_watchdog_wq_cb(void *data)
 		}
 		ieee->LinkDetectInfo.NumRecvBcnInPeriod = 0;
 		ieee->LinkDetectInfo.NumRecvDataInPeriod = 0;
-
 	}
 
 	spin_lock_irqsave(&priv->tx_lock, flags);
@@ -1549,7 +1537,6 @@ void rtl92e_tx_enable(struct net_device *dev)
 	rtllib_reset_queue(priv->rtllib);
 }
 
-
 static void _rtl92e_free_rx_ring(struct net_device *dev)
 {
 	struct r8192_priv *priv = rtllib_priv(dev);
@@ -1951,13 +1938,11 @@ long rtl92e_translate_to_dbm(struct r8192_priv *priv, u8 signal_strength_index)
 	return signal_power;
 }
 
-
 void rtl92e_update_rx_statistics(struct r8192_priv *priv,
 				 struct rtllib_rx_stats *pprevious_stats)
 {
 	int weighting = 0;
 
-
 	if (priv->stats.recv_signal_power == 0)
 		priv->stats.recv_signal_power =
 					 pprevious_stats->RecvSignalPower;
@@ -1981,7 +1966,6 @@ u8 rtl92e_rx_db_to_percent(s8 antpower)
 		return	100;
 	else
 		return	100 + antpower;
-
 }
 
 u8 rtl92e_evm_db_to_percent(s8 value)
@@ -2008,8 +1992,6 @@ void rtl92e_copy_mpdu_stats(struct rtllib_rx_stats *psrc_stats,
 	ptarget_stats->bFirstMPDU = psrc_stats->bFirstMPDU;
 }
 
-
-
 static void _rtl92e_rx_normal(struct net_device *dev)
 {
 	struct r8192_priv *priv = rtllib_priv(dev);
@@ -2113,7 +2095,6 @@ static void _rtl92e_rx_normal(struct net_device *dev)
 		priv->rx_idx[rx_queue_idx] = (priv->rx_idx[rx_queue_idx] + 1) %
 					      priv->rxringcount;
 	}
-
 }
 
 static void _rtl92e_tx_resume(struct net_device *dev)
@@ -2172,7 +2153,6 @@ static int _rtl92e_open(struct net_device *dev)
 	ret = _rtl92e_try_up(dev);
 	mutex_unlock(&priv->wx_mutex);
 	return ret;
-
 }
 
 static int _rtl92e_try_up(struct net_device *dev)
@@ -2184,7 +2164,6 @@ static int _rtl92e_try_up(struct net_device *dev)
 	return _rtl92e_up(dev, false);
 }
 
-
 static int _rtl92e_close(struct net_device *dev)
 {
 	struct r8192_priv *priv = rtllib_priv(dev);
@@ -2202,7 +2181,6 @@ static int _rtl92e_close(struct net_device *dev)
 	mutex_unlock(&priv->wx_mutex);
 
 	return ret;
-
 }
 
 static int _rtl92e_down(struct net_device *dev, bool shutdownrf)
@@ -2245,10 +2223,8 @@ static void _rtl92e_set_multicast(struct net_device *dev)
 
 	promisc = (dev->flags & IFF_PROMISC) ? 1 : 0;
 	priv->promisc = promisc;
-
 }
 
-
 static int _rtl92e_set_mac_adr(struct net_device *dev, void *mac)
 {
 	struct r8192_priv *priv = rtllib_priv(dev);
@@ -2388,7 +2364,6 @@ static int _rtl92e_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 	return ret;
 }
 
-
 static irqreturn_t _rtl92e_irq(int irq, void *netdev)
 {
 	struct net_device *dev = netdev;
@@ -2595,7 +2570,6 @@ static int _rtl92e_pci_probe(struct pci_dev *pdev,
 		goto err_rel_rtllib;
 	}
 
-
 	ioaddr = (unsigned long)ioremap_nocache(pmem_start, pmem_len);
 	if (ioaddr == (unsigned long)NULL) {
 		netdev_err(dev, "ioremap failed!");
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 40+ messages in thread

* Re: [PATCH v4 0/6] staging: rtl8192e: Fix coding style, warnings and checks
  2017-03-16 22:12                   ` [PATCH v4 0/6] staging: rtl8192e: Fix coding style, warnings and checks sunil.m
  2017-03-16 22:12                     ` [PATCH v4 4/6] staging: rtl8192e: Pass a pointer as an argument to sizeof() instead of struct sunil.m
  2017-03-16 22:12                     ` [PATCH v4 6/6] staging: rtl8192e: Fix blank lines and space after a cast sunil.m
@ 2017-03-17  6:16                     ` Greg KH
  2017-03-21  9:00                       ` [PATCH v5 " suniel.spartan
  2 siblings, 1 reply; 40+ messages in thread
From: Greg KH @ 2017-03-17  6:16 UTC (permalink / raw)
  To: sunil.m; +Cc: dan.carpenter, devel, karthiknishu, linux-kernel

On Fri, Mar 17, 2017 at 03:42:15AM +0530, sunil.m@techveda.org wrote:
> From: Suniel Mahesh <sunil.m@techveda.org>
> 
> Split earlier patches into multiple commits for easy review as
> suggested by Dan Carpenter.
> Modified subject, description and in few patches both for
> better readability as suggested by Greg KH.
> Dropped two patches from the earler series, as they were not adding 
> significant value, suggested by Dan Carpenter.
> Fixed the following issues reported by checkpatch.pl:
> Block comments should align the * on each line, aligned.
> Block comments use * on subsequent lines, other characters
> are replaced by * .
> Removed unnecessary 'out of memory' message.
> Comparison's to NULL could be written '!foo' or 'foo', modified.
> Replaced sizeof(struct foo) into sizeof(*ptr).
> Spaces preferred around that 'operator', spacing provided.
> Logical continuations should be on the previous line, modified accordingly.
> Unnecessary parentheses around variables, removed.
> Please use a blank line after function/struct/union/enum declarations, used.
> Blank lines aren't necessary after an open brace '{' and before a
> close brace '}', removed.
> No space is necessary after a cast, removed.
> Please don't use multiple blank lines, removed.

I have no idea what all of this means :(

Can you resend the full series, not just random patches in a series?  I
don't have any of the old ones anymore.

If I have applied other patches, just send this as a sequence that is
numbered properly, with all of the patches to be applied.

You need to make it very easy for a maintainer to know what to do here,
remember, we have no short-term memory of any previous submissions.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PATCH v2 5/5] staging: rtl8192e: Pass a pointer as an argument to sizeof() instead of struct
  2017-03-09 18:50     ` [PATCH v2 5/5] staging: rtl8192e: Pass a pointer as an argument to sizeof() instead of struct sunil.m
@ 2017-03-17  9:58       ` Suniel Mahesh
  0 siblings, 0 replies; 40+ messages in thread
From: Suniel Mahesh @ 2017-03-17  9:58 UTC (permalink / raw)
  To: sunil.m; +Cc: linux-kernel

On Friday 10 March 2017 12:20 AM, sunil.m@techveda.org wrote:
> From: Suniel Mahesh <sunil.m@techveda.org>
>
> Prefer vzalloc(sizeof(*priv->pFirmware)...) over
> vzalloc(sizeof(struct rt_firmware)...) as reported by checkpatch.pl
>
> Signed-off-by: Suniel Mahesh <sunil.m@techveda.org>
> ---
> Changes for v2:
>
> - new patch addition to the series
> - Rebased on top of next-20170306
> ---
>  drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
> index fb711d2..a099bce 100644
> --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
> +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
> @@ -965,7 +965,7 @@ static void _rtl92e_init_priv_variable(struct net_device *dev)
>
>  	priv->card_type = PCI;
>
> -	priv->pFirmware = vzalloc(sizeof(struct rt_firmware));
> +	priv->pFirmware = vzalloc(sizeof(*priv->pFirmware));
>  	if (!priv->pFirmware)
>  		return -ENOMEM;
>  	skb_queue_head_init(&priv->skb_queue);
>
ok

^ permalink raw reply	[flat|nested] 40+ messages in thread

* [PATCH v5 0/6] staging: rtl8192e: Fix coding style, warnings and checks
  2017-03-17  6:16                     ` [PATCH v4 0/6] staging: rtl8192e: Fix coding style, warnings and checks Greg KH
@ 2017-03-21  9:00                       ` suniel.spartan
  2017-03-21  9:01                         ` [PATCH v5 1/6] staging: rtl8192e: Fix comments as per kernel coding style suniel.spartan
                                           ` (5 more replies)
  0 siblings, 6 replies; 40+ messages in thread
From: suniel.spartan @ 2017-03-21  9:00 UTC (permalink / raw)
  To: gregkh, dan.carpenter; +Cc: linux-kernel, sunil.m, devel, Suniel Mahesh

From: Suniel Mahesh <suniel.spartan@gmail.com>

Changed email address from sunil.m@techveda.org to suniel.spartan@gmail.com,
reason being few patches were being dropped and not getting delivered,
couldn't resolve that issue.
Split earlier patches into multiple commits for easy review as
suggested by Dan Carpenter.
Modified subject, description and in few patches both for
better readability as suggested by Greg KH.
Dropped two patches from the earler series, as they were not adding 
significant value, suggested by Dan Carpenter.
Fixed the following issues reported by checkpatch.pl:
Block comments should align the * on each line, aligned.
Block comments use * on subsequent lines, other characters
are replaced by * .
Removed unnecessary 'out of memory' message.
Comparison's to NULL could be written '!foo' or 'foo', modified.
Replaced sizeof(struct foo) into sizeof(*ptr).
Spaces preferred around that 'operator', spacing provided.
Logical continuations should be on the previous line, modified accordingly.
Unnecessary parentheses around variables, removed.
Please use a blank line after function/struct/union/enum declarations, used.
Blank lines aren't necessary after an open brace '{' and before a
close brace '}', removed.
No space is necessary after a cast, removed.
Please don't use multiple blank lines, removed.

Rebased on top of next-20170310.
Patches were tested and built on next-20170310 and staging-testing
as suggested by Greg K-H, no errors reported.

Suniel Mahesh (6):
  staging: rtl8192e: Fix comments as per kernel coding style
  staging: rtl8192e: Remove unnecessary 'out of memory' message
  staging: rtl8192e: Rectify pointer comparisions with NULL
  staging: rtl8192e: Pass a pointer as an argument to sizeof() instead
    of struct
  staging: rtl8192e: Fix issues reported by checkpatch.pl
  staging: rtl8192e: Fix blank lines and space after a cast

 drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 141 ++++++++++-----------------
 1 file changed, 50 insertions(+), 91 deletions(-)

-- 
1.9.1

^ permalink raw reply	[flat|nested] 40+ messages in thread

* [PATCH v5 1/6] staging: rtl8192e: Fix comments as per kernel coding style
  2017-03-21  9:00                       ` [PATCH v5 " suniel.spartan
@ 2017-03-21  9:01                         ` suniel.spartan
  2017-03-21  9:01                         ` [PATCH v5 2/6] staging: rtl8192e: Remove unnecessary 'out of memory' message suniel.spartan
                                           ` (4 subsequent siblings)
  5 siblings, 0 replies; 40+ messages in thread
From: suniel.spartan @ 2017-03-21  9:01 UTC (permalink / raw)
  To: gregkh, dan.carpenter; +Cc: linux-kernel, sunil.m, devel, Suniel Mahesh

From: Suniel Mahesh <suniel.spartan@gmail.com>

Fixed the following checkpatch.pl warnings:
Block comments should align the * on each line
Block comments use * on subsequent lines

Signed-off-by: Suniel Mahesh <suniel.spartan@gmail.com>
---
Changes for v5:

- Changed email address from sunil.m@techveda.org to suniel.spartan@gmail.com,
  reason being few patches were being dropped and not getting delivered,
  couldn't resolve that issue
- Resending the whole series as requested by Greg K-H
- Patches were tested and built on next-20170310 and staging-testing

Changes for v4:

- Dropped two patches from the series, as they were not adding significant value
  suggested by Dan Carpenter.
  staging: rtl8192e: Fix coding style, this was fixing line over 80 characters.
  staging: rtl8192e: Fix unbalanced braces
- Resending the whole series as requested by Greg K-H
- Patches were tested and built on next-20170310 and staging-testing

Changes for v3:

- Split earlier patches into multiple commits for easy review
  as suggested by Greg K-H
- Modified subject and description for better readability
- Rebased on top of next-20170310
- Patches were tested and built on next-20170310 and staging-testing
  as suggested by Greg K-H, no errors reported

Changes for v2:

- Split larger patch into multiple commits as suggested
  by Dan Carpenter
- This patch fixes coding style issues, comments in rtl_core.c
  reported by checkpatch.pl
- Modified short description to 'Fix coding style issues' from
  'Fix coding style issues, improve error handling'
- Improve error handling is taken care by the following patch
  in the series
- Removed statements, 'Return -ENOMEM, if it is out of memory',
  'Pointer comparison with NULL replaced by logical NOT' from the
  body of the patch
- Rebased on top of next-20170306
---
 drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 61 ++++++++++------------------
 1 file changed, 22 insertions(+), 39 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
index 4c0caa6..a648064 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
@@ -1,4 +1,4 @@
-/******************************************************************************
+/*
  * Copyright(c) 2008 - 2010 Realtek Corporation. All rights reserved.
  *
  * Based on the r8180 driver, which is:
@@ -17,7 +17,7 @@
  *
  * Contact Information:
  * wlanfae <wlanfae@realtek.com>
-******************************************************************************/
+ */
 #include <linux/uaccess.h>
 #include <linux/pci.h>
 #include <linux/vmalloc.h>
@@ -75,12 +75,12 @@ static int _rtl92e_pci_probe(struct pci_dev *pdev,
 static irqreturn_t _rtl92e_irq(int irq, void *netdev);
 
 static struct pci_driver rtl8192_pci_driver = {
-	.name = DRV_NAME,	/* Driver name   */
-	.id_table = rtl8192_pci_id_tbl,	/* PCI_ID table  */
-	.probe	= _rtl92e_pci_probe,	/* probe fn      */
-	.remove	 = _rtl92e_pci_disconnect,	/* remove fn */
-	.suspend = rtl92e_suspend,	/* PM suspend fn */
-	.resume = rtl92e_resume,                 /* PM resume fn  */
+	.name = DRV_NAME,
+	.id_table = rtl8192_pci_id_tbl,
+	.probe	= _rtl92e_pci_probe,
+	.remove	 = _rtl92e_pci_disconnect,
+	.suspend = rtl92e_suspend,
+	.resume = rtl92e_resume,
 };
 
 static short _rtl92e_is_tx_queue_empty(struct net_device *dev);
@@ -100,10 +100,7 @@ static void _rtl92e_hard_data_xmit(struct sk_buff *skb, struct net_device *dev,
 static int _rtl92e_down(struct net_device *dev, bool shutdownrf);
 static void _rtl92e_restart(void *data);
 
-/****************************************************************************
-   -----------------------------IO STUFF-------------------------
-*****************************************************************************/
-
+/* IO STUFF */
 u8 rtl92e_readb(struct net_device *dev, int x)
 {
 	return 0xff & readb((u8 __iomem *)dev->mem_start + x);
@@ -140,9 +137,7 @@ void rtl92e_writew(struct net_device *dev, int x, u16 y)
 	udelay(20);
 }
 
-/****************************************************************************
-   -----------------------------GENERAL FUNCTION-------------------------
-*****************************************************************************/
+/* GENERAL FUNCTION */
 bool rtl92e_set_rf_state(struct net_device *dev,
 			 enum rt_rf_power_state StateToSet,
 			 RT_RF_CHANGE_SOURCE ChangeSource)
@@ -978,7 +973,6 @@ static void _rtl92e_init_priv_variable(struct net_device *dev)
 	if (!priv->pFirmware)
 		netdev_err(dev,
 			   "rtl8192e: Unable to allocate space for firmware\n");
-
 	skb_queue_head_init(&priv->skb_queue);
 
 	for (i = 0; i < MAX_QUEUE_SIZE; i++)
@@ -1101,9 +1095,7 @@ static short _rtl92e_init(struct net_device *dev)
 	return 0;
 }
 
-/***************************************************************************
-	-------------------------------WATCHDOG STUFF---------------------------
-***************************************************************************/
+/* WATCHDOG STUFF */
 static short _rtl92e_is_tx_queue_empty(struct net_device *dev)
 {
 	int i = 0;
@@ -1540,9 +1532,7 @@ static void _rtl92e_watchdog_timer_cb(unsigned long data)
 		  msecs_to_jiffies(RTLLIB_WATCH_DOG_TIME));
 }
 
-/****************************************************************************
- ---------------------------- NIC TX/RX STUFF---------------------------
-*****************************************************************************/
+/* NIC TX/RX STUFF */
 void rtl92e_rx_enable(struct net_device *dev)
 {
 	struct r8192_priv *priv = rtllib_priv(dev);
@@ -1982,6 +1972,7 @@ void rtl92e_update_rx_statistics(struct r8192_priv *priv,
 					weighting) / 6;
 }
 
+/* QueryRxPwrPercentage */
 u8 rtl92e_rx_db_to_percent(s8 antpower)
 {
 	if ((antpower <= -100) || (antpower >= 20))
@@ -1991,7 +1982,7 @@ u8 rtl92e_rx_db_to_percent(s8 antpower)
 	else
 		return	100 + antpower;
 
-}	/* QueryRxPwrPercentage */
+}
 
 u8 rtl92e_evm_db_to_percent(s8 value)
 {
@@ -2052,9 +2043,9 @@ static void _rtl92e_rx_normal(struct net_device *dev)
 		pdesc, skb))
 			goto done;
 		new_skb = dev_alloc_skb(priv->rxbuffersize);
-		/* if allocation of new skb failed - drop current packet
-		 * and reuse skb
-		 */
+/* if allocation of new skb failed - drop current packet
+ * and reuse skb
+ */
 		if (unlikely(!new_skb))
 			goto done;
 
@@ -2066,7 +2057,7 @@ static void _rtl92e_rx_normal(struct net_device *dev)
 		skb_put(skb, pdesc->Length);
 		skb_reserve(skb, stats.RxDrvInfoSize +
 			stats.RxBufShift);
-		skb_trim(skb, skb->len - 4/*sCrcLng*/);
+		skb_trim(skb, skb->len - 4/* sCrcLng */);
 		rtllib_hdr = (struct rtllib_hdr_1addr *)skb->data;
 		if (!is_multicast_ether_addr(rtllib_hdr->addr1)) {
 			/* unicast packet */
@@ -2155,9 +2146,7 @@ static void _rtl92e_irq_rx_tasklet(struct r8192_priv *priv)
 		      rtl92e_readl(priv->rtllib->dev, INTA_MASK) | IMR_RDU);
 }
 
-/****************************************************************************
- ---------------------------- NIC START/CLOSE STUFF---------------------------
-*****************************************************************************/
+/* NIC START/CLOSE STUFF */
 static void _rtl92e_cancel_deferred_work(struct r8192_priv *priv)
 {
 	cancel_delayed_work_sync(&priv->watch_dog_wq);
@@ -2532,11 +2521,7 @@ static irqreturn_t _rtl92e_irq(int irq, void *netdev)
 	return IRQ_HANDLED;
 }
 
-
-
-/****************************************************************************
-	---------------------------- PCI_STUFF---------------------------
-*****************************************************************************/
+/* PCI_STUFF */
 static const struct net_device_ops rtl8192_netdev_ops = {
 	.ndo_open = _rtl92e_open,
 	.ndo_stop = _rtl92e_close,
@@ -2620,7 +2605,7 @@ static int _rtl92e_pci_probe(struct pci_dev *pdev,
 	dev->mem_end = ioaddr + pci_resource_len(pdev, 0);
 
 	pci_read_config_byte(pdev, 0x08, &revision_id);
-	/* If the revisionid is 0x10, the device uses rtl8192se. */
+	/* If the revisionid is 0x10, the device uses rtl8192se */
 	if (pdev->device == 0x8192 && revision_id == 0x10)
 		goto err_unmap;
 
@@ -2784,9 +2769,7 @@ void rtl92e_check_rfctrl_gpio_timer(unsigned long data)
 		  msecs_to_jiffies(RTLLIB_WATCH_DOG_TIME));
 }
 
-/***************************************************************************
-	------------------- module init / exit stubs ----------------
-****************************************************************************/
+/* module init / exit stubs */
 MODULE_DESCRIPTION("Linux driver for Realtek RTL819x WiFi cards");
 MODULE_AUTHOR(DRV_COPYRIGHT " " DRV_AUTHOR);
 MODULE_VERSION(DRV_VERSION);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v5 2/6] staging: rtl8192e: Remove unnecessary 'out of memory' message
  2017-03-21  9:00                       ` [PATCH v5 " suniel.spartan
  2017-03-21  9:01                         ` [PATCH v5 1/6] staging: rtl8192e: Fix comments as per kernel coding style suniel.spartan
@ 2017-03-21  9:01                         ` suniel.spartan
  2017-03-21  9:01                         ` [PATCH v5 3/6] staging: rtl8192e: Rectify pointer comparisions with NULL suniel.spartan
                                           ` (3 subsequent siblings)
  5 siblings, 0 replies; 40+ messages in thread
From: suniel.spartan @ 2017-03-21  9:01 UTC (permalink / raw)
  To: gregkh, dan.carpenter; +Cc: linux-kernel, sunil.m, devel, Suniel Mahesh

From: Suniel Mahesh <suniel.spartan@gmail.com>

Fixed the following checkpatch.pl warning:
Possible unnecessary 'out of memory' message
If it is out of memory, function should return with an
appropriate error code. Since this function is of type void,
a return statement is used.

Signed-off-by: Suniel Mahesh <suniel.spartan@gmail.com>
---
Changes for v5:

- Changed email address from sunil.m@techveda.org to suniel.spartan@gmail.com,
  reason being few patches were being dropped and not getting delivered,
  couldn't resolve that issue
- Resending the whole series as requested by Greg K-H
- Patches were tested and built on next-20170310 and staging-testing

Changes for v4:

- Modified description for better readability as pointed out by
  Dan Carpenter
- Dropped two patches from the series, as they were not adding significant value
  suggested by Dan Carpenter.
  staging: rtl8192e: Fix coding style, this was fixing line over 80 characters.
  staging: rtl8192e: Fix unbalanced braces
- Resending the whole series as requested by Greg K-H
- Patches were tested and built on next-20170310 and staging-testing

Changes for v3:

- Split earlier patches into multiple commits for easy review
  as suggested by Greg K-H
- Modified subject and description for better readability
- Rebased on top of next-20170310
- Patches were tested and built on next-20170310 and staging-testing
  as suggested by Greg K-H, no errors reported

Changes for v2:

- Improve error handling reported by checkpatch.pl in rtl_core.c
- new patch addition to the series
- Rebased on top of next-20170306
---
 drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
index a648064..f00ee3b 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
@@ -971,8 +971,8 @@ static void _rtl92e_init_priv_variable(struct net_device *dev)
 
 	priv->pFirmware = vzalloc(sizeof(struct rt_firmware));
 	if (!priv->pFirmware)
-		netdev_err(dev,
-			   "rtl8192e: Unable to allocate space for firmware\n");
+		return;
+
 	skb_queue_head_init(&priv->skb_queue);
 
 	for (i = 0; i < MAX_QUEUE_SIZE; i++)
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v5 3/6] staging: rtl8192e: Rectify pointer comparisions with NULL
  2017-03-21  9:00                       ` [PATCH v5 " suniel.spartan
  2017-03-21  9:01                         ` [PATCH v5 1/6] staging: rtl8192e: Fix comments as per kernel coding style suniel.spartan
  2017-03-21  9:01                         ` [PATCH v5 2/6] staging: rtl8192e: Remove unnecessary 'out of memory' message suniel.spartan
@ 2017-03-21  9:01                         ` suniel.spartan
  2017-03-21  9:01                         ` [PATCH v5 4/6] staging: rtl8192e: Pass a pointer as an argument to sizeof() instead of struct suniel.spartan
                                           ` (2 subsequent siblings)
  5 siblings, 0 replies; 40+ messages in thread
From: suniel.spartan @ 2017-03-21  9:01 UTC (permalink / raw)
  To: gregkh, dan.carpenter; +Cc: linux-kernel, sunil.m, devel, Suniel Mahesh

From: Suniel Mahesh <suniel.spartan@gmail.com>

This patch simplifies code by replacing explicit NULL comparison
with ! or unmark operator
Reported by checkpatch.pl for comparison to NULL could be
written '!foo' or 'foo'

Signed-off-by: Suniel Mahesh <suniel.spartan@gmail.com>
---
Changes for v5:

- Changed email address from sunil.m@techveda.org to suniel.spartan@gmail.com,
  reason being few patches were being dropped and not getting delivered,
  couldn't resolve that issue
- Resending the whole series as requested by Greg K-H
- Patches were tested and built on next-20170310 and staging-testing

Changes for v4:

- Dropped two patches from the series, as they were not adding significant value
  suggested by Dan Carpenter.
  staging: rtl8192e: Fix coding style, this was fixing line over 80 characters.
  staging: rtl8192e: Fix unbalanced braces
- Resending the whole series as requested by Greg K-H
- Patches were tested and built on next-20170310 and staging-testing

Changes for v3:

- Split earlier patches into multiple commits for easy review
  as suggested by Greg K-H
- Modified description for better readability
- Rebased on top of next-20170310
- Patches were tested and built on next-20170310 and staging-testing
  as suggested by Greg K-H, no errors reported

Changes for v2:

- Rectify pointer comparisions reported by checkpatch.pl in rtl_core.c
- new patch addition to the series
- Rebased on top of next-20170306
---
 drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
index f00ee3b..4f4cd07 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
@@ -472,7 +472,7 @@ static int _rtl92e_qos_assoc_resp(struct r8192_priv *priv,
 	u32 size = sizeof(struct rtllib_qos_parameters);
 	int set_qos_param = 0;
 
-	if ((priv == NULL) || (network == NULL))
+	if (!priv || !network)
 		return 0;
 
 	if (priv->rtllib->state != RTLLIB_LINKED)
@@ -785,7 +785,7 @@ static int _rtl92e_sta_down(struct net_device *dev, bool shutdownrf)
 	if (priv->up == 0)
 		return -1;
 
-	if (priv->rtllib->rtllib_ips_leave != NULL)
+	if (priv->rtllib->rtllib_ips_leave)
 		priv->rtllib->rtllib_ips_leave(dev);
 
 	if (priv->rtllib->state == RTLLIB_LINKED)
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v5 4/6] staging: rtl8192e: Pass a pointer as an argument to sizeof() instead of struct
  2017-03-21  9:00                       ` [PATCH v5 " suniel.spartan
                                           ` (2 preceding siblings ...)
  2017-03-21  9:01                         ` [PATCH v5 3/6] staging: rtl8192e: Rectify pointer comparisions with NULL suniel.spartan
@ 2017-03-21  9:01                         ` suniel.spartan
  2017-03-21  9:01                         ` [PATCH v5 5/6] staging: rtl8192e: Fix issues reported by checkpatch.pl suniel.spartan
  2017-03-21  9:01                         ` [PATCH v5 6/6] staging: rtl8192e: Fix blank lines and space after a cast suniel.spartan
  5 siblings, 0 replies; 40+ messages in thread
From: suniel.spartan @ 2017-03-21  9:01 UTC (permalink / raw)
  To: gregkh, dan.carpenter; +Cc: linux-kernel, sunil.m, devel, Suniel Mahesh

From: Suniel Mahesh <suniel.spartan@gmail.com>

Replaced sizeof(struct foo) into sizeof(*ptr), found by checkpatch.pl

Signed-off-by: Suniel Mahesh <suniel.spartan@gmail.com>
---
Changes for v5:

- Changed email address from sunil.m@techveda.org to suniel.spartan@gmail.com,
  reason being few patches were being dropped and not getting delivered,
  couldn't resolve that issue
- Resending the whole series as requested by Greg K-H
- Patches were tested and built on next-20170310 and staging-testing

Changes for v4:

- Dropped two patches from the series, as they were not adding significant value
  suggested by Dan Carpenter.
  staging: rtl8192e: Fix coding style, this was fixing line over 80 characters.
  staging: rtl8192e: Fix unbalanced braces
- Resending the whole series as requested by Greg K-H
- Patches were tested and built on next-20170310 and staging-testing

Changes for v3:

- Split earlier patches into multiple commits for easy review
  as suggested by Greg K-H
- Modified description for better readability
- Rebased on top of next-20170310
- Patches were tested and built on next-20170310 and staging-testing
  as suggested by Greg K-H, no errors reported

Changes for v2:

- new patch addition to the series
- Rebased on top of next-20170306
---
 drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
index 4f4cd07..999af05 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
@@ -969,7 +969,7 @@ static void _rtl92e_init_priv_variable(struct net_device *dev)
 
 	priv->card_type = PCI;
 
-	priv->pFirmware = vzalloc(sizeof(struct rt_firmware));
+	priv->pFirmware = vzalloc(sizeof(*priv->pFirmware));
 	if (!priv->pFirmware)
 		return;
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v5 5/6] staging: rtl8192e: Fix issues reported by checkpatch.pl
  2017-03-21  9:00                       ` [PATCH v5 " suniel.spartan
                                           ` (3 preceding siblings ...)
  2017-03-21  9:01                         ` [PATCH v5 4/6] staging: rtl8192e: Pass a pointer as an argument to sizeof() instead of struct suniel.spartan
@ 2017-03-21  9:01                         ` suniel.spartan
  2017-03-21  9:01                         ` [PATCH v5 6/6] staging: rtl8192e: Fix blank lines and space after a cast suniel.spartan
  5 siblings, 0 replies; 40+ messages in thread
From: suniel.spartan @ 2017-03-21  9:01 UTC (permalink / raw)
  To: gregkh, dan.carpenter; +Cc: linux-kernel, sunil.m, devel, Suniel Mahesh

From: Suniel Mahesh <suniel.spartan@gmail.com>

Fixed the following checkpatch.pl checks:
spaces preferred around that 'operator', spacing provided
Logical continuations should be on the previous line, modified accordingly
Unnecessary parentheses around variables, removed
Please use a blank line after function/struct/union/enum declarations, used

Signed-off-by: Suniel Mahesh <suniel.spartan@gmail.com>
---
Changes for v5:

- Changed email address from sunil.m@techveda.org to suniel.spartan@gmail.com,
  reason being few patches were being dropped and not getting delivered,
  couldn't resolve that issue
- Resending the whole series as requested by Greg K-H
- Patches were tested and built on next-20170310 and staging-testing

Changes for v4:

- Dropped two patches from the series, as they were not adding significant value
  suggested by Dan Carpenter.
  staging: rtl8192e: Fix coding style, this was fixing line over 80 characters.
  staging: rtl8192e: Fix unbalanced braces
- Resending the whole series as requested by Greg K-H
- Patches were tested and built on next-20170310 and staging-testing

Changes for v3:

- Split earlier patches into multiple commits for easy review
  as suggested by Greg K-H
- New patch addition to the series
- Rebased on top of next-20170310
- Patches were tested and built on next-20170310 and staging-testing
  as suggested by Greg K-H, no errors reported

Changes for v2:
---
 drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 46 +++++++++++++++-------------
 1 file changed, 24 insertions(+), 22 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
index 999af05..1d22f18 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
@@ -341,7 +341,7 @@ static void _rtl92e_update_cap(struct net_device *dev, u16 cap)
 		}
 	}
 
-	if (net->mode & (IEEE_G|IEEE_N_24G)) {
+	if (net->mode & (IEEE_G | IEEE_N_24G)) {
 		u8	slot_time_val;
 		u8	CurSlotTime = priv->slot_time;
 
@@ -675,7 +675,7 @@ static u8 _rtl92e_get_supported_wireless_mode(struct net_device *dev)
 	case RF_8256:
 	case RF_6052:
 	case RF_PSEUDO_11N:
-		ret = (WIRELESS_MODE_N_24G|WIRELESS_MODE_G | WIRELESS_MODE_B);
+		ret = (WIRELESS_MODE_N_24G | WIRELESS_MODE_G | WIRELESS_MODE_B);
 		break;
 	case RF_8258:
 		ret = (WIRELESS_MODE_A | WIRELESS_MODE_N_5G);
@@ -737,7 +737,7 @@ static int _rtl92e_sta_up(struct net_device *dev, bool is_silent_reset)
 {
 	struct r8192_priv *priv = rtllib_priv(dev);
 	struct rt_pwr_save_ctrl *pPSC = (struct rt_pwr_save_ctrl *)
-					(&(priv->rtllib->PowerSaveControl));
+					(&priv->rtllib->PowerSaveControl);
 	bool init_status = true;
 
 	priv->bDriverIsGoingToUnload = false;
@@ -883,7 +883,7 @@ static void _rtl92e_init_priv_constant(struct net_device *dev)
 {
 	struct r8192_priv *priv = rtllib_priv(dev);
 	struct rt_pwr_save_ctrl *pPSC = (struct rt_pwr_save_ctrl *)
-					&(priv->rtllib->PowerSaveControl);
+					&priv->rtllib->PowerSaveControl;
 
 	pPSC->RegMaxLPSAwakeIntvl = 5;
 }
@@ -1009,9 +1009,9 @@ static void _rtl92e_init_priv_task(struct net_device *dev)
 			      (void *)_rtl92e_update_beacon, dev);
 	INIT_WORK_RSL(&priv->qos_activate, (void *)_rtl92e_qos_activate, dev);
 	INIT_DELAYED_WORK_RSL(&priv->rtllib->hw_wakeup_wq,
-			      (void *) rtl92e_hw_wakeup_wq, dev);
+			      (void *)rtl92e_hw_wakeup_wq, dev);
 	INIT_DELAYED_WORK_RSL(&priv->rtllib->hw_sleep_wq,
-			      (void *) rtl92e_hw_sleep_wq, dev);
+			      (void *)rtl92e_hw_sleep_wq, dev);
 	tasklet_init(&priv->irq_rx_tasklet,
 		     (void(*)(unsigned long))_rtl92e_irq_rx_tasklet,
 		     (unsigned long)priv);
@@ -1029,8 +1029,8 @@ static short _rtl92e_get_channel_map(struct net_device *dev)
 
 	struct r8192_priv *priv = rtllib_priv(dev);
 
-	if ((priv->rf_chip != RF_8225) && (priv->rf_chip != RF_8256)
-			&& (priv->rf_chip != RF_6052)) {
+	if ((priv->rf_chip != RF_8225) && (priv->rf_chip != RF_8256) &&
+						(priv->rf_chip != RF_6052)) {
 		netdev_err(dev, "%s: unknown rf chip, can't set channel map\n",
 			   __func__);
 		return -1;
@@ -1056,7 +1056,7 @@ static short _rtl92e_init(struct net_device *dev)
 {
 	struct r8192_priv *priv = rtllib_priv(dev);
 
-	memset(&(priv->stats), 0, sizeof(struct rt_stats));
+	memset(&priv->stats, 0, sizeof(struct rt_stats));
 
 	_rtl92e_init_priv_handler(dev);
 	_rtl92e_init_priv_constant(dev);
@@ -1071,7 +1071,7 @@ static short _rtl92e_init(struct net_device *dev)
 
 	setup_timer(&priv->watch_dog_timer,
 		    _rtl92e_watchdog_timer_cb,
-		    (unsigned long) dev);
+		    (unsigned long)dev);
 
 	setup_timer(&priv->gpio_polling_timer,
 		    rtl92e_check_rfctrl_gpio_timer,
@@ -1126,7 +1126,7 @@ static enum reset_type _rtl92e_tx_check_stuck(struct net_device *dev)
 	switch (priv->rtllib->ps) {
 	case RTLLIB_PS_DISABLED:
 		break;
-	case (RTLLIB_PS_MBCAST|RTLLIB_PS_UNICAST):
+	case (RTLLIB_PS_MBCAST | RTLLIB_PS_UNICAST):
 		break;
 	default:
 		break;
@@ -1379,7 +1379,7 @@ static void _rtl92e_watchdog_wq_cb(void *data)
 	static u8 check_reset_cnt;
 	unsigned long flags;
 	struct rt_pwr_save_ctrl *pPSC = (struct rt_pwr_save_ctrl *)
-					(&(priv->rtllib->PowerSaveControl));
+					(&priv->rtllib->PowerSaveControl);
 	bool bBusyTraffic = false;
 	bool	bHigherBusyTraffic = false;
 	bool	bHigherBusyRxTraffic = false;
@@ -1461,7 +1461,7 @@ static void _rtl92e_watchdog_wq_cb(void *data)
 
 		_rtl92e_update_rxcounts(priv, &TotalRxBcnNum, &TotalRxDataNum);
 
-		if ((TotalRxBcnNum+TotalRxDataNum) == 0)
+		if ((TotalRxBcnNum + TotalRxDataNum) == 0)
 			priv->check_roaming_cnt++;
 		else
 			priv->check_roaming_cnt = 0;
@@ -1489,7 +1489,7 @@ static void _rtl92e_watchdog_wq_cb(void *data)
 			notify_wx_assoc_event(ieee);
 
 			if (!(ieee->rtllib_ap_sec_type(ieee) &
-			     (SEC_ALG_CCMP|SEC_ALG_TKIP)))
+			     (SEC_ALG_CCMP | SEC_ALG_TKIP)))
 				schedule_delayed_work(
 					&ieee->associate_procedure_wq, 0);
 
@@ -1593,7 +1593,7 @@ static void _rtl92e_free_tx_ring(struct net_device *dev, unsigned int prio)
 		ring->idx = (ring->idx + 1) % ring->entries;
 	}
 
-	pci_free_consistent(priv->pdev, sizeof(*ring->desc)*ring->entries,
+	pci_free_consistent(priv->pdev, sizeof(*ring->desc) * ring->entries,
 	ring->desc, ring->dma);
 	ring->desc = NULL;
 }
@@ -1702,7 +1702,7 @@ static void _rtl92e_tx_cmd(struct net_device *dev, struct sk_buff *skb)
 	ring = &priv->tx_ring[TXCMD_QUEUE];
 
 	idx = (ring->idx + skb_queue_len(&ring->queue)) % ring->entries;
-	entry = (struct tx_desc_cmd *) &ring->desc[idx];
+	entry = (struct tx_desc_cmd *)&ring->desc[idx];
 
 	tcb_desc = (struct cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE);
 
@@ -2022,7 +2022,7 @@ static void _rtl92e_rx_normal(struct net_device *dev)
 
 	struct rtllib_rx_stats stats = {
 		.signal = 0,
-		.noise = (u8) -98,
+		.noise = (u8)-98,
 		.rate = 0,
 		.freq = RTLLIB_24GHZ_BAND,
 	};
@@ -2095,7 +2095,7 @@ static void _rtl92e_rx_normal(struct net_device *dev)
 
 		priv->rx_buf[rx_queue_idx][priv->rx_idx[rx_queue_idx]] =
 								 skb;
-		*((dma_addr_t *) skb->cb) = pci_map_single(priv->pdev,
+		*((dma_addr_t *)skb->cb) = pci_map_single(priv->pdev,
 					    skb_tail_pointer_rsl(skb),
 					    priv->rxbuffersize,
 					    PCI_DMA_FROMDEVICE);
@@ -2108,7 +2108,7 @@ static void _rtl92e_rx_normal(struct net_device *dev)
 		pdesc->BufferAddress = *((dma_addr_t *)skb->cb);
 		pdesc->OWN = 1;
 		pdesc->Length = priv->rxbuffersize;
-		if (priv->rx_idx[rx_queue_idx] == priv->rxringcount-1)
+		if (priv->rx_idx[rx_queue_idx] == priv->rxringcount - 1)
 			pdesc->EOR = 1;
 		priv->rx_idx[rx_queue_idx] = (priv->rx_idx[rx_queue_idx] + 1) %
 					      priv->rxringcount;
@@ -2337,8 +2337,9 @@ static int _rtl92e_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 							       0, key);
 					}
 				}
-				if ((ieee->pairwise_key_type == KEY_TYPE_CCMP)
-				     && ieee->pHTInfo->bCurrentHTSupport) {
+				if ((ieee->pairwise_key_type ==
+				     KEY_TYPE_CCMP) &&
+				     ieee->pHTInfo->bCurrentHTSupport) {
 					rtl92e_writeb(dev, 0x173, 1);
 				}
 
@@ -2711,7 +2712,7 @@ bool rtl92e_enable_nic(struct net_device *dev)
 	bool init_status = true;
 	struct r8192_priv *priv = rtllib_priv(dev);
 	struct rt_pwr_save_ctrl *pPSC = (struct rt_pwr_save_ctrl *)
-					(&(priv->rtllib->PowerSaveControl));
+					(&priv->rtllib->PowerSaveControl);
 
 	if (!priv->up) {
 		netdev_warn(dev, "%s(): Driver is already down!\n", __func__);
@@ -2736,6 +2737,7 @@ bool rtl92e_enable_nic(struct net_device *dev)
 	RT_TRACE(COMP_PS, "<===========%s()\n", __func__);
 	return init_status;
 }
+
 bool rtl92e_disable_nic(struct net_device *dev)
 {
 	struct r8192_priv *priv = rtllib_priv(dev);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v5 6/6] staging: rtl8192e: Fix blank lines and space after a cast
  2017-03-21  9:00                       ` [PATCH v5 " suniel.spartan
                                           ` (4 preceding siblings ...)
  2017-03-21  9:01                         ` [PATCH v5 5/6] staging: rtl8192e: Fix issues reported by checkpatch.pl suniel.spartan
@ 2017-03-21  9:01                         ` suniel.spartan
  5 siblings, 0 replies; 40+ messages in thread
From: suniel.spartan @ 2017-03-21  9:01 UTC (permalink / raw)
  To: gregkh, dan.carpenter; +Cc: linux-kernel, sunil.m, devel, Suniel Mahesh

From: Suniel Mahesh <suniel.spartan@gmail.com>

Fixed the following checkpatch.pl checks:
Blank lines aren't necessary after an open brace '{'
and before a close brace '}', removed
No space is necessary after a cast, removed
Please don't use multiple blank lines, removed

Signed-off-by: Suniel Mahesh <suniel.spartan@gmail.com>
---
Changes for v5:

- Changed email address from sunil.m@techveda.org to suniel.spartan@gmail.com,
  reason being few patches were being dropped and not getting delivered,
  couldn't resolve that issue
- Resending the whole series as requested by Greg K-H
- Patches were tested and built on next-20170310 and staging-testing

Changes for v4:

- Dropped two patches from the series, as they were not adding significant value
  suggested by Dan Carpenter.
  staging: rtl8192e: Fix coding style, this was fixing line over 80 characters.
  staging: rtl8192e: Fix unbalanced braces
- Resending the whole series as requested by Greg K-H
- Patches were tested and built on next-20170310 and staging-testing

Changes for v3:

- Split earlier patches into multiple commits for easy review
  as suggested by Greg K-H
- New patch addition to the series
- Rebased on top of next-20170310
- Patches were tested and built on next-20170310 and staging-testing
  as suggested by Greg K-H, no errors reported

Changes for v2:
---
 drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 26 --------------------------
 1 file changed, 26 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
index 1d22f18..bc2c732 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
@@ -37,7 +37,6 @@
 static int channels = 0x3fff;
 static char *ifname = "wlan%d";
 
-
 static const struct rtl819x_ops rtl819xp_ops = {
 	.nic_type			= NIC_8192E,
 	.get_eeprom_size		= rtl92e_get_eeprom_size,
@@ -195,7 +194,6 @@ bool rtl92e_set_rf_state(struct net_device *dev,
 			priv->rtllib->RfOffReason = 0;
 			bActionAllowed = true;
 
-
 			if (rtState == eRfOff &&
 			    ChangeSource >= RF_CHANGE_BY_HW)
 				bConnectBySSID = true;
@@ -242,7 +240,6 @@ bool rtl92e_set_rf_state(struct net_device *dev,
 			 StateToSet, priv->rtllib->RfOffReason);
 		PHY_SetRFPowerState(dev, StateToSet);
 		if (StateToSet == eRfOn) {
-
 			if (bConnectBySSID && priv->blinked_ingpio) {
 				schedule_delayed_work(
 					 &ieee->associate_procedure_wq, 0);
@@ -401,8 +398,6 @@ static void _rtl92e_qos_activate(void *data)
 
 	for (i = 0; i <  QOS_QUEUE_NUM; i++)
 		priv->rtllib->SetHwRegHandler(dev, HW_VAR_AC_PARAM, (u8 *)(&i));
-
-
 success:
 	mutex_unlock(&priv->mutex);
 }
@@ -462,7 +457,6 @@ static int _rtl92e_handle_beacon(struct net_device *dev,
 
 	schedule_delayed_work(&priv->update_beacon_wq, 0);
 	return 0;
-
 }
 
 static int _rtl92e_qos_assoc_resp(struct r8192_priv *priv,
@@ -888,7 +882,6 @@ static void _rtl92e_init_priv_constant(struct net_device *dev)
 	pPSC->RegMaxLPSAwakeIntvl = 5;
 }
 
-
 static void _rtl92e_init_priv_variable(struct net_device *dev)
 {
 	struct r8192_priv *priv = rtllib_priv(dev);
@@ -1211,7 +1204,6 @@ static enum reset_type _rtl92e_if_check_reset(struct net_device *dev)
 	} else {
 		return RESET_TYPE_NORESET;
 	}
-
 }
 
 static void _rtl92e_if_silent_reset(struct net_device *dev)
@@ -1223,7 +1215,6 @@ static void _rtl92e_if_silent_reset(struct net_device *dev)
 	unsigned long flag;
 
 	if (priv->ResetProgress == RESET_TYPE_NORESET) {
-
 		RT_TRACE(COMP_RESET, "=========>Reset progress!!\n");
 
 		priv->ResetProgress = RESET_TYPE_SILENT;
@@ -1417,7 +1408,6 @@ static void _rtl92e_watchdog_wq_cb(void *data)
 		ieee->LinkDetectInfo.NumTxOkInPeriod > 100)
 			bBusyTraffic = true;
 
-
 		if (ieee->LinkDetectInfo.NumRxOkInPeriod > 4000 ||
 		    ieee->LinkDetectInfo.NumTxOkInPeriod > 4000) {
 			bHigherBusyTraffic = true;
@@ -1466,7 +1456,6 @@ static void _rtl92e_watchdog_wq_cb(void *data)
 		else
 			priv->check_roaming_cnt = 0;
 
-
 		if (priv->check_roaming_cnt > 0) {
 			if (ieee->eRFPowerState == eRfOff)
 				netdev_info(dev, "%s(): RF is off\n", __func__);
@@ -1497,7 +1486,6 @@ static void _rtl92e_watchdog_wq_cb(void *data)
 		}
 		ieee->LinkDetectInfo.NumRecvBcnInPeriod = 0;
 		ieee->LinkDetectInfo.NumRecvDataInPeriod = 0;
-
 	}
 
 	spin_lock_irqsave(&priv->tx_lock, flags);
@@ -1549,7 +1537,6 @@ void rtl92e_tx_enable(struct net_device *dev)
 	rtllib_reset_queue(priv->rtllib);
 }
 
-
 static void _rtl92e_free_rx_ring(struct net_device *dev)
 {
 	struct r8192_priv *priv = rtllib_priv(dev);
@@ -1951,13 +1938,11 @@ long rtl92e_translate_to_dbm(struct r8192_priv *priv, u8 signal_strength_index)
 	return signal_power;
 }
 
-
 void rtl92e_update_rx_statistics(struct r8192_priv *priv,
 				 struct rtllib_rx_stats *pprevious_stats)
 {
 	int weighting = 0;
 
-
 	if (priv->stats.recv_signal_power == 0)
 		priv->stats.recv_signal_power =
 					 pprevious_stats->RecvSignalPower;
@@ -1981,7 +1966,6 @@ u8 rtl92e_rx_db_to_percent(s8 antpower)
 		return	100;
 	else
 		return	100 + antpower;
-
 }
 
 u8 rtl92e_evm_db_to_percent(s8 value)
@@ -2008,8 +1992,6 @@ void rtl92e_copy_mpdu_stats(struct rtllib_rx_stats *psrc_stats,
 	ptarget_stats->bFirstMPDU = psrc_stats->bFirstMPDU;
 }
 
-
-
 static void _rtl92e_rx_normal(struct net_device *dev)
 {
 	struct r8192_priv *priv = rtllib_priv(dev);
@@ -2113,7 +2095,6 @@ static void _rtl92e_rx_normal(struct net_device *dev)
 		priv->rx_idx[rx_queue_idx] = (priv->rx_idx[rx_queue_idx] + 1) %
 					      priv->rxringcount;
 	}
-
 }
 
 static void _rtl92e_tx_resume(struct net_device *dev)
@@ -2172,7 +2153,6 @@ static int _rtl92e_open(struct net_device *dev)
 	ret = _rtl92e_try_up(dev);
 	mutex_unlock(&priv->wx_mutex);
 	return ret;
-
 }
 
 static int _rtl92e_try_up(struct net_device *dev)
@@ -2184,7 +2164,6 @@ static int _rtl92e_try_up(struct net_device *dev)
 	return _rtl92e_up(dev, false);
 }
 
-
 static int _rtl92e_close(struct net_device *dev)
 {
 	struct r8192_priv *priv = rtllib_priv(dev);
@@ -2202,7 +2181,6 @@ static int _rtl92e_close(struct net_device *dev)
 	mutex_unlock(&priv->wx_mutex);
 
 	return ret;
-
 }
 
 static int _rtl92e_down(struct net_device *dev, bool shutdownrf)
@@ -2245,10 +2223,8 @@ static void _rtl92e_set_multicast(struct net_device *dev)
 
 	promisc = (dev->flags & IFF_PROMISC) ? 1 : 0;
 	priv->promisc = promisc;
-
 }
 
-
 static int _rtl92e_set_mac_adr(struct net_device *dev, void *mac)
 {
 	struct r8192_priv *priv = rtllib_priv(dev);
@@ -2388,7 +2364,6 @@ static int _rtl92e_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 	return ret;
 }
 
-
 static irqreturn_t _rtl92e_irq(int irq, void *netdev)
 {
 	struct net_device *dev = netdev;
@@ -2595,7 +2570,6 @@ static int _rtl92e_pci_probe(struct pci_dev *pdev,
 		goto err_rel_rtllib;
 	}
 
-
 	ioaddr = (unsigned long)ioremap_nocache(pmem_start, pmem_len);
 	if (ioaddr == (unsigned long)NULL) {
 		netdev_err(dev, "ioremap failed!");
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 40+ messages in thread

end of thread, other threads:[~2017-03-21  9:02 UTC | newest]

Thread overview: 40+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-07  7:09 [PATCH] staging: rtl8192e: fix coding style issue, improve error handling Suniel Mahesh
2017-03-07 17:12 ` Dan Carpenter
2017-03-09 18:50   ` [PATCH v2 0/5] staging: rtl8192e: Fix coding style, warnings and checks sunil.m
2017-03-09 18:50     ` [PATCH v2 1/5] staging: rtl8192e: Fix coding style issues sunil.m
2017-03-11  8:11       ` kbuild test robot
2017-03-12 13:41       ` Greg KH
2017-03-15  9:51         ` [PATCH v3 0/8] staging: rtl8192e: Fix coding style, warnings and checks sunil.m
2017-03-15  9:51           ` [PATCH v3 1/8] staging: rtl8192e: Fix comments as per kernel coding style sunil.m
2017-03-15  9:51           ` [PATCH v3 2/8] staging: rtl8192e: Fix " sunil.m
2017-03-15 10:14             ` Dan Carpenter
2017-03-15 11:09               ` Suniel Mahesh
2017-03-15 11:15                 ` Dan Carpenter
2017-03-15 10:15             ` Dan Carpenter
2017-03-15  9:51           ` [PATCH v3 3/8] staging: rtl8192e: Remove unnecessary 'out of memory' message sunil.m
2017-03-15 10:16             ` Dan Carpenter
2017-03-15 10:58               ` [PATCH v4 " sunil.m
2017-03-16  2:36                 ` Greg KH
2017-03-16 22:12                   ` [PATCH v4 0/6] staging: rtl8192e: Fix coding style, warnings and checks sunil.m
2017-03-16 22:12                     ` [PATCH v4 4/6] staging: rtl8192e: Pass a pointer as an argument to sizeof() instead of struct sunil.m
2017-03-16 22:12                     ` [PATCH v4 6/6] staging: rtl8192e: Fix blank lines and space after a cast sunil.m
2017-03-17  6:16                     ` [PATCH v4 0/6] staging: rtl8192e: Fix coding style, warnings and checks Greg KH
2017-03-21  9:00                       ` [PATCH v5 " suniel.spartan
2017-03-21  9:01                         ` [PATCH v5 1/6] staging: rtl8192e: Fix comments as per kernel coding style suniel.spartan
2017-03-21  9:01                         ` [PATCH v5 2/6] staging: rtl8192e: Remove unnecessary 'out of memory' message suniel.spartan
2017-03-21  9:01                         ` [PATCH v5 3/6] staging: rtl8192e: Rectify pointer comparisions with NULL suniel.spartan
2017-03-21  9:01                         ` [PATCH v5 4/6] staging: rtl8192e: Pass a pointer as an argument to sizeof() instead of struct suniel.spartan
2017-03-21  9:01                         ` [PATCH v5 5/6] staging: rtl8192e: Fix issues reported by checkpatch.pl suniel.spartan
2017-03-21  9:01                         ` [PATCH v5 6/6] staging: rtl8192e: Fix blank lines and space after a cast suniel.spartan
2017-03-15  9:51           ` [PATCH v3 4/8] staging: rtl8192e: Rectify pointer comparisions with NULL sunil.m
2017-03-15  9:51           ` [PATCH v3 5/8] staging: rtl8192e: Fix unbalanced braces sunil.m
2017-03-15 10:24             ` Dan Carpenter
2017-03-15  9:51           ` [PATCH v3 6/8] staging: rtl8192e: Pass a pointer as an argument to sizeof() instead of struct sunil.m
2017-03-15  9:51           ` [PATCH v3 7/8] staging: rtl8192e: Fix issues reported by checkpatch.pl sunil.m
2017-03-15  9:51           ` [PATCH v3 8/8] staging: rtl8192e: Fix blank lines and space after a cast sunil.m
2017-03-09 18:50     ` [PATCH v2 2/5] staging: rtl8192e: Improve error handling sunil.m
2017-03-09 18:50     ` [PATCH v2 3/5] staging: rtl8192e: Rectify pointer comparisions sunil.m
2017-03-09 18:50     ` [PATCH v2 4/5] staging: rtl8192e: Fix unbalanced braces around else statement sunil.m
2017-03-09 18:50     ` [PATCH v2 5/5] staging: rtl8192e: Pass a pointer as an argument to sizeof() instead of struct sunil.m
2017-03-17  9:58       ` Suniel Mahesh
2017-03-09 18:50 ` [PATCH] staging: rtl8192e: fix coding style issue, improve error handling kbuild test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.