lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190529134529.8481-1-nishkadg.linux@gmail.com>
Date:   Wed, 29 May 2019 19:15:29 +0530
From:   Nishka Dasgupta <nishkadg.linux@...il.com>
To:     forest@...ttletooquiet.net, gregkh@...uxfoundation.org,
        madhumithabiw@...il.com, brandonbonaby94@...il.com,
        devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org
Cc:     Nishka Dasgupta <nishkadg.linux@...il.com>
Subject: [PATCH] staging: vt6655: Change return type of function and remove variable

As the function CARDbRadioPowerOff always returns true, and this value
does not appear to be used anywhere, the return variable can be entirely
removed and the function converted to type void.
Issue found with Coccinelle.

Signed-off-by: Nishka Dasgupta <nishkadg.linux@...il.com>
---
 drivers/staging/vt6655/card.c | 56 ++++++++++++++++-------------------
 drivers/staging/vt6655/card.h |  2 +-
 2 files changed, 27 insertions(+), 31 deletions(-)

diff --git a/drivers/staging/vt6655/card.c b/drivers/staging/vt6655/card.c
index 6ecbe925026d..2aca5b38be5c 100644
--- a/drivers/staging/vt6655/card.c
+++ b/drivers/staging/vt6655/card.c
@@ -409,42 +409,38 @@ bool CARDbSetBeaconPeriod(struct vnt_private *priv,
  *  Out:
  *      none
  *
- * Return Value: true if success; otherwise false
+ * Return Value: none
  */
-bool CARDbRadioPowerOff(struct vnt_private *priv)
+void CARDbRadioPowerOff(struct vnt_private *priv)
 {
-	bool bResult = true;
-
-	if (priv->bRadioOff)
-		return true;
-
-	switch (priv->byRFType) {
-	case RF_RFMD2959:
-		MACvWordRegBitsOff(priv->PortOffset, MAC_REG_SOFTPWRCTL,
-				   SOFTPWRCTL_TXPEINV);
-		MACvWordRegBitsOn(priv->PortOffset, MAC_REG_SOFTPWRCTL,
-				  SOFTPWRCTL_SWPE1);
-		break;
+	if (!priv->bRadioOff) {
+		switch (priv->byRFType) {
+		case RF_RFMD2959:
+			MACvWordRegBitsOff(priv->PortOffset, MAC_REG_SOFTPWRCTL,
+					   SOFTPWRCTL_TXPEINV);
+			MACvWordRegBitsOn(priv->PortOffset, MAC_REG_SOFTPWRCTL,
+					  SOFTPWRCTL_SWPE1);
+			break;
 
-	case RF_AIROHA:
-	case RF_AL2230S:
-	case RF_AIROHA7230:
-		MACvWordRegBitsOff(priv->PortOffset, MAC_REG_SOFTPWRCTL,
-				   SOFTPWRCTL_SWPE2);
-		MACvWordRegBitsOff(priv->PortOffset, MAC_REG_SOFTPWRCTL,
-				   SOFTPWRCTL_SWPE3);
-		break;
-	}
+		case RF_AIROHA:
+		case RF_AL2230S:
+		case RF_AIROHA7230:
+			MACvWordRegBitsOff(priv->PortOffset, MAC_REG_SOFTPWRCTL,
+					   SOFTPWRCTL_SWPE2);
+			MACvWordRegBitsOff(priv->PortOffset, MAC_REG_SOFTPWRCTL,
+					   SOFTPWRCTL_SWPE3);
+			break;
+		}
 
-	MACvRegBitsOff(priv->PortOffset, MAC_REG_HOSTCR, HOSTCR_RXON);
+		MACvRegBitsOff(priv->PortOffset, MAC_REG_HOSTCR, HOSTCR_RXON);
 
-	BBvSetDeepSleep(priv, priv->byLocalID);
+		BBvSetDeepSleep(priv, priv->byLocalID);
 
-	priv->bRadioOff = true;
-	pr_debug("chester power off\n");
-	MACvRegBitsOn(priv->PortOffset, MAC_REG_GPIOCTL0,
-		      LED_ACTSET);  /* LED issue */
-	return bResult;
+		priv->bRadioOff = true;
+		pr_debug("chester power off\n");
+		MACvRegBitsOn(priv->PortOffset, MAC_REG_GPIOCTL0,
+			      LED_ACTSET);  /* LED issue */
+	}
 }
 
 /*
diff --git a/drivers/staging/vt6655/card.h b/drivers/staging/vt6655/card.h
index f422fb3c78bd..887c1692e05b 100644
--- a/drivers/staging/vt6655/card.h
+++ b/drivers/staging/vt6655/card.h
@@ -57,7 +57,7 @@ u64 CARDqGetTSFOffset(unsigned char byRxRate, u64 qwTSF1, u64 qwTSF2);
 unsigned char CARDbyGetPktType(struct vnt_private *priv);
 void CARDvSafeResetTx(struct vnt_private *priv);
 void CARDvSafeResetRx(struct vnt_private *priv);
-bool CARDbRadioPowerOff(struct vnt_private *priv);
+void CARDbRadioPowerOff(struct vnt_private *priv);
 bool CARDbRadioPowerOn(struct vnt_private *priv);
 bool CARDbSetPhyParameter(struct vnt_private *priv, u8 bb_type);
 bool CARDbUpdateTSF(struct vnt_private *priv, unsigned char byRxRate,
-- 
2.19.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ