* [PATCH v2 1/3] Staging: wilc1000: wilc_wfi_cfgoperations: Remove unused code
2015-10-13 13:13 [PATCH v2 0/3] Remove constant and unused code Shivani Bhardwaj
@ 2015-10-13 13:13 ` Shivani Bhardwaj
2015-10-13 13:14 ` [PATCH v2 2/3] Staging: wilc1000: wilc_wfi_cfgoperations: Change variable to bool Shivani Bhardwaj
2015-10-13 13:14 ` [PATCH v2 3/3] Staging: wilc1000: wilc_wfi_netdevice: Remove definition of a constant Shivani Bhardwaj
2 siblings, 0 replies; 4+ messages in thread
From: Shivani Bhardwaj @ 2015-10-13 13:13 UTC (permalink / raw)
To: outreachy-kernel; +Cc: outreachy-kernel
Remove a flag variable which is not used anywhere in the code.
Semantic patch used:
@@
type T;
identifier i;
constant C;
position p != e.p;
@@
- T i@p;
<+... when != i
- i = C;
...+>
Signed-off-by: Shivani Bhardwaj <shivanib134@gmail.com>
---
Changes in v2:
-Remove the definition of constant from header file,
include one more patch.
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 6472777..d2e6f55 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -1764,7 +1764,6 @@ static int del_pmksa(struct wiphy *wiphy, struct net_device *netdev,
{
u32 i;
- u8 flag = 0;
s32 s32Error = 0;
struct wilc_priv *priv = wiphy_priv(wiphy);
@@ -1777,7 +1776,6 @@ static int del_pmksa(struct wiphy *wiphy, struct net_device *netdev,
/*If bssid is found, reset the values*/
PRINT_D(CFG80211_DBG, "Reseting PMKID values\n");
memset(&priv->pmkid_list.pmkidlist[i], 0, sizeof(struct host_if_pmkid));
- flag = PMKID_FOUND;
break;
}
}
--
2.1.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH v2 2/3] Staging: wilc1000: wilc_wfi_cfgoperations: Change variable to bool
2015-10-13 13:13 [PATCH v2 0/3] Remove constant and unused code Shivani Bhardwaj
2015-10-13 13:13 ` [PATCH v2 1/3] Staging: wilc1000: wilc_wfi_cfgoperations: Remove " Shivani Bhardwaj
@ 2015-10-13 13:14 ` Shivani Bhardwaj
2015-10-13 13:14 ` [PATCH v2 3/3] Staging: wilc1000: wilc_wfi_netdevice: Remove definition of a constant Shivani Bhardwaj
2 siblings, 0 replies; 4+ messages in thread
From: Shivani Bhardwaj @ 2015-10-13 13:14 UTC (permalink / raw)
To: outreachy-kernel; +Cc: outreachy-kernel
Change variable of the type u8 to bool as the only values acquired by it
are true or false.
Signed-off-by: Shivani Bhardwaj <shivanib134@gmail.com>
---
Changes in v2:
-Remove the definition of constant from header file,
include one more patch.
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index d2e6f55..e4c134a 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -1714,7 +1714,7 @@ static int set_pmksa(struct wiphy *wiphy, struct net_device *netdev,
{
u32 i;
s32 s32Error = 0;
- u8 flag = 0;
+ bool pmkid_found = false;
struct wilc_priv *priv = wiphy_priv(wiphy);
@@ -1725,7 +1725,7 @@ static int set_pmksa(struct wiphy *wiphy, struct net_device *netdev,
if (!memcmp(pmksa->bssid, priv->pmkid_list.pmkidlist[i].bssid,
ETH_ALEN)) {
/*If bssid already exists and pmkid value needs to reset*/
- flag = PMKID_FOUND;
+ pmkid_found = true;
PRINT_D(CFG80211_DBG, "PMKID already exists\n");
break;
}
@@ -1736,7 +1736,7 @@ static int set_pmksa(struct wiphy *wiphy, struct net_device *netdev,
ETH_ALEN);
memcpy(priv->pmkid_list.pmkidlist[i].pmkid, pmksa->pmkid,
PMKID_LEN);
- if (!(flag == PMKID_FOUND))
+ if (!pmkid_found)
priv->pmkid_list.numpmkid++;
} else {
PRINT_ER("Invalid PMKID index\n");
--
2.1.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH v2 3/3] Staging: wilc1000: wilc_wfi_netdevice: Remove definition of a constant
2015-10-13 13:13 [PATCH v2 0/3] Remove constant and unused code Shivani Bhardwaj
2015-10-13 13:13 ` [PATCH v2 1/3] Staging: wilc1000: wilc_wfi_cfgoperations: Remove " Shivani Bhardwaj
2015-10-13 13:14 ` [PATCH v2 2/3] Staging: wilc1000: wilc_wfi_cfgoperations: Change variable to bool Shivani Bhardwaj
@ 2015-10-13 13:14 ` Shivani Bhardwaj
2 siblings, 0 replies; 4+ messages in thread
From: Shivani Bhardwaj @ 2015-10-13 13:14 UTC (permalink / raw)
To: outreachy-kernel; +Cc: outreachy-kernel
Remove definition of the constant PMKID_FOUND as it is not required to
be used in the entire code.
Signed-off-by: Shivani Bhardwaj <shivanib134@gmail.com>
---
Changes in v2:
-Remove the definition of constant from header file,
include one more patch.
drivers/staging/wilc1000/wilc_wfi_netdevice.h | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index cb21968..553ed60 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -14,8 +14,7 @@
#define WILC_WFI_TIMEOUT 5
#define WILC_MAX_NUM_PMKIDS 16
#define PMKID_LEN 16
-#define PMKID_FOUND 1
- #define NUM_STA_ASSOCIATED 8
+#define NUM_STA_ASSOCIATED 8
#include <linux/module.h>
#include <linux/init.h>
--
2.1.0
^ permalink raw reply related [flat|nested] 4+ messages in thread