[PATCH 3/3] staging: wilc1000: Remove unnecessary array index check

2018-05-06 Thread Nathan Chancellor
This statment triggers GCC's -Wtype-limit since key_index is an
unsigned integer so it cannot be less than zero.

Signed-off-by: Nathan Chancellor 
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index b499fb987395..e0015ca6c21a 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -1054,7 +1054,7 @@ static int del_key(struct wiphy *wiphy, struct net_device 
*netdev,
}
}
 
-   if (key_index >= 0 && key_index <= 3 && priv->wep_key_len[key_index]) {
+   if (key_index <= 3 && priv->wep_key_len[key_index]) {
memset(priv->wep_key[key_index], 0,
   priv->wep_key_len[key_index]);
priv->wep_key_len[key_index] = 0;
-- 
2.17.0



[PATCH 1/3] staging: wilc1000: Remove unused variables

2018-05-06 Thread Nathan Chancellor
GCC warns these variables are all set but never used so remove them.

Signed-off-by: Nathan Chancellor 
---
 drivers/staging/wilc1000/host_interface.c | 12 
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c |  6 --
 2 files changed, 18 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 28edd904b33a..3fd4c8e62da6 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -1432,13 +1432,7 @@ static s32 handle_rcvd_gnrl_async_info(struct wilc_vif 
*vif,
 {
s32 result = 0;
u8 msg_type = 0;
-   u8 msg_id = 0;
-   u16 msg_len = 0;
-   u16 wid_id = (u16)WID_NIL;
-   u8 wid_len  = 0;
u8 mac_status;
-   u8 mac_status_reason_code;
-   u8 mac_status_additional_info;
struct host_if_drv *hif_drv = vif->hif_drv;
 
if (!rcvd_info->buffer) {
@@ -1472,13 +1466,7 @@ static s32 handle_rcvd_gnrl_async_info(struct wilc_vif 
*vif,
return -EFAULT;
}
 
-   msg_id = rcvd_info->buffer[1];
-   msg_len = MAKE_WORD16(rcvd_info->buffer[2], 
rcvd_info->buffer[3]);
-   wid_id = MAKE_WORD16(rcvd_info->buffer[4], 
rcvd_info->buffer[5]);
-   wid_len = rcvd_info->buffer[6];
mac_status  = rcvd_info->buffer[7];
-   mac_status_reason_code = rcvd_info->buffer[8];
-   mac_status_additional_info = rcvd_info->buffer[9];
if (hif_drv->hif_state == HOST_IF_WAITING_CONN_RESP) {
host_int_parse_assoc_resp_info(vif, mac_status);
} else if ((mac_status == MAC_STATUS_DISCONNECTED) &&
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 8be3c4c57579..76b4afaef423 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -917,12 +917,10 @@ static int add_key(struct wiphy *wiphy, struct net_device 
*netdev, u8 key_index,
const u8 *tx_mic = NULL;
u8 mode = NO_ENCRYPT;
u8 op_mode;
-   struct wilc *wl;
struct wilc_vif *vif;
 
priv = wiphy_priv(wiphy);
vif = netdev_priv(netdev);
-   wl = vif->wilc;
 
switch (params->cipher) {
case WLAN_CIPHER_SUITE_WEP40:
@@ -1885,12 +1883,10 @@ static int start_ap(struct wiphy *wiphy, struct 
net_device *dev,
struct cfg80211_ap_settings *settings)
 {
struct cfg80211_beacon_data *beacon = &settings->beacon;
-   struct wilc_priv *priv;
s32 ret = 0;
struct wilc *wl;
struct wilc_vif *vif;
 
-   priv = wiphy_priv(wiphy);
vif = netdev_priv(dev);
wl = vif->wilc;
 
@@ -2016,14 +2012,12 @@ static int change_station(struct wiphy *wiphy, struct 
net_device *dev,
  const u8 *mac, struct station_parameters *params)
 {
s32 ret = 0;
-   struct wilc_priv *priv;
struct add_sta_param sta_params = { {0} };
struct wilc_vif *vif;
 
if (!wiphy)
return -EFAULT;
 
-   priv = wiphy_priv(wiphy);
vif = netdev_priv(dev);
 
if (vif->iftype == AP_MODE || vif->iftype == GO_MODE) {
-- 
2.17.0



[PATCH 2/3] staging: wilc1000: Remove useless function

2018-05-06 Thread Nathan Chancellor
GCC warns that 'wid' is unused in wilc_remove_key and it's correct; the
variable is only local. Get rid of the function (since it just returns
zero) and shuffle the remaining code into one if statement.

Signed-off-by: Nathan Chancellor 
---
 drivers/staging/wilc1000/host_interface.c | 12 
 drivers/staging/wilc1000/host_interface.h |  1 -
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 14 +-
 3 files changed, 5 insertions(+), 22 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 3fd4c8e62da6..b5f3829e9903 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -2606,18 +2606,6 @@ static void timer_connect_cb(struct timer_list *t)
wilc_enqueue_cmd(&msg);
 }
 
-s32 wilc_remove_key(struct host_if_drv *hif_drv, const u8 *sta_addr)
-{
-   struct wid wid;
-
-   wid.id = (u16)WID_REMOVE_KEY;
-   wid.type = WID_STR;
-   wid.val = (s8 *)sta_addr;
-   wid.size = 6;
-
-   return 0;
-}
-
 int wilc_remove_wep_key(struct wilc_vif *vif, u8 index)
 {
int result = 0;
diff --git a/drivers/staging/wilc1000/host_interface.h 
b/drivers/staging/wilc1000/host_interface.h
index 7a26f341e0ba..08b3ba7df8b4 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -303,7 +303,6 @@ struct add_sta_param {
 };
 
 struct wilc_vif;
-s32 wilc_remove_key(struct host_if_drv *hif_drv, const u8 *sta_addr);
 int wilc_remove_wep_key(struct wilc_vif *vif, u8 index);
 int wilc_set_wep_default_keyid(struct wilc_vif *vif, u8 index);
 int wilc_add_wep_key_bss_sta(struct wilc_vif *vif, const u8 *key, u8 len,
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 76b4afaef423..b499fb987395 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -1054,15 +1054,11 @@ static int del_key(struct wiphy *wiphy, struct 
net_device *netdev,
}
}
 
-   if (key_index >= 0 && key_index <= 3) {
-   if (priv->wep_key_len[key_index]) {
-   memset(priv->wep_key[key_index], 0,
-  priv->wep_key_len[key_index]);
-   priv->wep_key_len[key_index] = 0;
-   wilc_remove_wep_key(vif, key_index);
-   }
-   } else {
-   wilc_remove_key(priv->hif_drv, mac_addr);
+   if (key_index >= 0 && key_index <= 3 && priv->wep_key_len[key_index]) {
+   memset(priv->wep_key[key_index], 0,
+  priv->wep_key_len[key_index]);
+   priv->wep_key_len[key_index] = 0;
+   wilc_remove_wep_key(vif, key_index);
}
 
return 0;
-- 
2.17.0



[PATCH] mwifiex: delete unneeded include

2018-05-06 Thread Julia Lawall
Nothing that is defined in 11ac.h is referenced in cmdevt.c.

Signed-off-by: Julia Lawall 

---
 drivers/net/wireless/marvell/mwifiex/cmdevt.c |1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/cmdevt.c 
b/drivers/net/wireless/marvell/mwifiex/cmdevt.c
index 7014f44..9cfcdf6 100644
--- a/drivers/net/wireless/marvell/mwifiex/cmdevt.c
+++ b/drivers/net/wireless/marvell/mwifiex/cmdevt.c
@@ -25,7 +25,6 @@
 #include "main.h"
 #include "wmm.h"
 #include "11n.h"
-#include "11ac.h"
 
 static void mwifiex_cancel_pending_ioctl(struct mwifiex_adapter *adapter);
 



[PATCH v3] iwlwifi: compare with actual number of IRQs requested for, not number of CPUs

2018-05-06 Thread Hao Wei Tee
When there are 16 or more logical CPUs, we request for `IWL_MAX_RX_HW_QUEUES` 
(16)
IRQs only as we limit to that number of IRQs, but later on we compare the
number of IRQs returned to nr_online_cpus+2 instead of max_irqs, the latter
being what we actually asked for. This ends up setting num_rx_queues to 17
which causes lots of out-of-bounds array accesses later on.

Compare to max_irqs instead, and also add an assertion in case num_rx_queues
> IWM_MAX_RX_HW_QUEUES.

Signed-off-by: Hao Wei Tee 
---
I think this is a better fix than what I sent previously.

But you guys are probably looking into it now, so please disregard my
probably-incorrect fix.

Thanks.

 drivers/net/wireless/intel/iwlwifi/pcie/trans.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c 
b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
index 6e9a9ecfb11c..aa469046f86c 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
@@ -1633,16 +1633,17 @@ static void iwl_pcie_set_interrupt_capa(struct pci_dev 
*pdev,
 * Two interrupts less: non rx causes shared with FBQ and RSS.
 * More than two interrupts: we will use fewer RSS queues.
 */
-   if (num_irqs <= nr_online_cpus) {
+   if (num_irqs <= max_irqs - 2) {
trans_pcie->trans->num_rx_queues = num_irqs + 1;
trans_pcie->shared_vec_mask = IWL_SHARED_IRQ_NON_RX |
IWL_SHARED_IRQ_FIRST_RSS;
-   } else if (num_irqs == nr_online_cpus + 1) {
+   } else if (num_irqs == max_irqs - 1) {
trans_pcie->trans->num_rx_queues = num_irqs;
trans_pcie->shared_vec_mask = IWL_SHARED_IRQ_NON_RX;
} else {
trans_pcie->trans->num_rx_queues = num_irqs - 1;
}
+   WARN_ON(trans_pcie->trans->num_rx_queues > IWL_MAX_RX_HW_QUEUES);
 
trans_pcie->alloc_vecs = num_irqs;
trans_pcie->msix_enabled = true;
-- 
2.17.0


[linux-firmware] Version in WHENCE file

2018-05-06 Thread Sedat Dilek
Hi Luca,

I hope I catched the correct MLs (not sure if linux-firmware has a ML,
I did not found any in the MAINTAINERS file).

I have seen that in the WHENCE file there is "Version" with and
without ":", mostly iwlwifi ucodes.

As an example:

 File: iwlwifi-8265-36.ucode
-Version 36.e91976c0.0
+Version: 36.e91976c0.0

I don't know the workflow: Do you want to fix it in your tree or
directly in linux-firmware.git upstream?
My attached patch is against upstream.

Thanks.

Regards,
- Sedat -


[1] 
https://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/linux-firmware.git/commit/?id=1f4dbd8cb94ec37497e58627a127058d53c5968f
From 576d30ace8140ca7b5c8a276f67da1cb2ebfb0c2 Mon Sep 17 00:00:00 2001
From: Sedat Dilek 
Date: Sun, 6 May 2018 14:44:54 +0200
Subject: [PATCH] WHENCE: Fix typo Version

---
 WHENCE | 58 +-
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/WHENCE b/WHENCE
index 690a6a5d4149..ab915ee6b24f 100644
--- a/WHENCE
+++ b/WHENCE
@@ -866,10 +866,10 @@ File: iwlwifi-7260-13.ucode
 Version: 25.30.13.0
 
 File: iwlwifi-7260-16.ucode
-Version 16.242414.0
+Version: 16.242414.0
 
 File: iwlwifi-7260-17.ucode
-Version 17.388f111f.0
+Version: 17.388f111f.0
 
 File: iwlwifi-3160-7.ucode
 Version: 22.1.7.0
@@ -890,10 +890,10 @@ File: iwlwifi-3160-13.ucode
 Version: 25.30.13.0
 
 File: iwlwifi-3160-16.ucode
-Version 16.242414.0
+Version: 16.242414.0
 
 File: iwlwifi-3160-17.ucode
-Version 17.388f111f.0
+Version: 17.388f111f.0
 
 File: iwlwifi-7265-8.ucode
 Version: 22.24.8.0
@@ -911,10 +911,10 @@ File: iwlwifi-7265-13.ucode
 Version: 25.30.13.0
 
 File: iwlwifi-7265-16.ucode
-Version 16.242414.0
+Version: 16.242414.0
 
 File: iwlwifi-7265-17.ucode
-Version 17.388f111f.0
+Version: 17.388f111f.0
 
 File: iwlwifi-7265D-10.ucode
 Version: 23.15.10.0
@@ -926,76 +926,76 @@ File: iwlwifi-7265D-13.ucode
 Version: 25.30.13.0
 
 File: iwlwifi-7265D-16.ucode
-Version 16.242414.0
+Version: 16.242414.0
 
 File: iwlwifi-7265D-17.ucode
-Version 17.352738.0
+Version: 17.352738.0
 
 File: iwlwifi-7265D-21.ucode
-Version 21.302800.0
+Version: 21.302800.0
 
 File: iwlwifi-7265D-22.ucode
-Version 22.391740.0
+Version: 22.391740.0
 
 File: iwlwifi-7265D-27.ucode
-Version 27.541033.0
+Version: 27.541033.0
 
 File: iwlwifi-7265D-29.ucode
-Version 29.3e3b4de5.0
+Version: 29.3e3b4de5.0
 
 File: iwlwifi-3168-21.ucode
-Version 21.302800.0
+Version: 21.302800.0
 
 File: iwlwifi-3168-22.ucode
-Version 22.391740.0
+Version: 22.391740.0
 
 File: iwlwifi-3168-27.ucode
-Version 27.541033.0
+Version: 27.541033.0
 
 File: iwlwifi-3168-29.ucode
-Version 29.3e3b4de5.0
+Version: 29.3e3b4de5.0
 
 File: iwlwifi-8000C-13.ucode
 Version: 25.30.13.0
 
 File: iwlwifi-8000C-16.ucode
-Version 16.242414.0
+Version: 16.242414.0
 
 File: iwlwifi-8000C-21.ucode
-Version 21.302800.0
+Version: 21.302800.0
 
 File: iwlwifi-8000C-22.ucode
-Version 22.391740.0
+Version: 22.391740.0
 
 File: iwlwifi-8000C-27.ucode
-Version 27.541033.0
+Version: 27.541033.0
 
 File: iwlwifi-8000C-31.ucode
-Version 31.560484.0
+Version: 31.560484.0
 
 File: iwlwifi-8000C-34.ucode
-Version 34.610288.0
+Version: 34.610288.0
 
 File: iwlwifi-8000C-36.ucode
-Version 36.e91976c0.0
+Version: 36.e91976c0.0
 
 File: iwlwifi-8265-21.ucode
-Version 21.302800.0
+Version: 21.302800.0
 
 File: iwlwifi-8265-22.ucode
-Version 22.391740.0
+Version: 22.391740.0
 
 File: iwlwifi-8265-27.ucode
-Version 27.541033.0
+Version: 27.541033.0
 
 File: iwlwifi-8265-31.ucode
-Version 31.560484.0
+Version: 31.560484.0
 
 File: iwlwifi-8265-34.ucode
-Version 34.610288.0
+Version: 34.610288.0
 
 File: iwlwifi-8265-36.ucode
-Version 36.e91976c0.0
+Version: 36.e91976c0.0
 
 File: iwlwifi-9000-pu-b0-jf-b0-33.ucode
 Version: 33.610294.0
-- 
2.17.0



Re: [linux-firmware] Version in WHENCE file

2018-05-06 Thread Luciano Coelho
On Sun, 2018-05-06 at 14:46 +0200, Sedat Dilek wrote:
> Hi Luca,
> 
> I hope I catched the correct MLs (not sure if linux-firmware has a
> ML,
> I did not found any in the MAINTAINERS file).
> 
> I have seen that in the WHENCE file there is "Version" with and
> without ":", mostly iwlwifi ucodes.
> 
> As an example:
> 
>  File: iwlwifi-8265-36.ucode
> -Version 36.e91976c0.0
> +Version: 36.e91976c0.0
> 
> I don't know the workflow: Do you want to fix it in your tree or
> directly in linux-firmware.git upstream?
> My attached patch is against upstream.

Thanks, Sedat!

I'm going to send a new pull-request this week, so I can include your
patch in my tree and as part of the pull-request.

--
Cheers,
Luca.


[PATCH] ath10k: fix return value check in wake_tx_q op

2018-05-06 Thread Erik Stromdahl
ath10k_mac_tx_push_txq returns either a postive integer (length) on
success or a negative error code on error.

The "if (ret) break;" statement will thus always break out of the loop
immediately after ath10k_mac_tx_push_txq has returned (making the loop
pointless).

A side effect of this fix is that we will iterate the queue until
ath10k_mac_tx_push_txq returns -ENOENT. This will make sure the queue is
not added back to ar->txqs when it is empty. This could potentially
improve performance somewhat (I have seen a small improvement with SDIO
devices).

Signed-off-by: Erik Stromdahl 
---
 drivers/net/wireless/ath/ath10k/mac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index 3d7119ad7c7a..487a7a7380fd 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -4290,7 +4290,7 @@ static void ath10k_mac_op_wake_tx_queue(struct 
ieee80211_hw *hw,
 
while (ath10k_mac_tx_can_push(hw, f_txq) && max--) {
ret = ath10k_mac_tx_push_txq(hw, f_txq);
-   if (ret)
+   if (ret < 0)
break;
}
if (ret != -ENOENT)
-- 
2.17.0



Re: Incorrect mesh path seq num

2018-05-06 Thread Greg Maitz
Yes, I confirmed it to be due to mismatched structures of
ieee80211_rann_ie between the two versions. Issue resolved.

On Sat, Sep 9, 2017 at 5:58 AM, Thomas Pedersen  wrote:
> On Mon, Sep 4, 2017 at 6:19 AM, Johannes Berg  
> wrote:
>> On Fri, 2017-09-01 at 13:07 -0700, Thomas Pedersen wrote:
>>> On Thu, Aug 31, 2017 at 11:30 PM, Greg Maitz 
>>> wrote:
>>> > Hi guys,
>>> >
>>> > I'm seeing a problem when I work on the wireless mesh between two
>>> > linux devices. The root node has 3.18 kernel while the next hop
>>> > station runs 2.6.37 kernel. I found the mpath->sn value is
>>> > incorrect
>>> > most of the time on the device having 2.6.37 kernel. After
>>> > examining
>>> > the code, in function hwmp_route_info_get [mesh_hwmp.c], after
>>> > mesh_path_lookup, the sequence number (i.e, mpath->sn) is
>>> > incorrect.
>>> > For instance, I see mpath->sn having value 0x3095. It should be
>>> > 0x9530, while the orig_sn is having value 0x9531.
>>>
>>> Looks like an endianess bug. Are you testing on two platforms of
>>> different endianess?
>>
>> Even if that's the case, wouldn't it mean some kind of conversion is
>> missing somewhere?
>
> Yes. I looked for a missing conversion, but couldn't find it.
>
> Greg, where / how are you printing mpath->sn? mpath dump or a printk you 
> added?
>
> --
> thomas


Re: [PATCH 1/3] staging: wilc1000: Remove unused variables

2018-05-06 Thread Ajay Singh
Thank you for the patch series.

On Sun, 6 May 2018 00:33:31 -0700
Nathan Chancellor  wrote:

> GCC warns these variables are all set but never used so remove them.
> 
> Signed-off-by: Nathan Chancellor 

Reviewed-by: Ajay Singh 

> ---
>  drivers/staging/wilc1000/host_interface.c | 12 
>  drivers/staging/wilc1000/wilc_wfi_cfgoperations.c |  6 --
>  2 files changed, 18 deletions(-)
> 
> diff --git a/drivers/staging/wilc1000/host_interface.c
> b/drivers/staging/wilc1000/host_interface.c index
> 28edd904b33a..3fd4c8e62da6 100644 ---
> a/drivers/staging/wilc1000/host_interface.c +++
> b/drivers/staging/wilc1000/host_interface.c @@ -1432,13 +1432,7 @@
> static s32 handle_rcvd_gnrl_async_info(struct wilc_vif *vif, {
>   s32 result = 0;
>   u8 msg_type = 0;
> - u8 msg_id = 0;
> - u16 msg_len = 0;
> - u16 wid_id = (u16)WID_NIL;
> - u8 wid_len  = 0;
>   u8 mac_status;
> - u8 mac_status_reason_code;
> - u8 mac_status_additional_info;
>   struct host_if_drv *hif_drv = vif->hif_drv;
>  
>   if (!rcvd_info->buffer) {
> @@ -1472,13 +1466,7 @@ static s32 handle_rcvd_gnrl_async_info(struct
> wilc_vif *vif, return -EFAULT;
>   }
>  
> - msg_id = rcvd_info->buffer[1];
> - msg_len = MAKE_WORD16(rcvd_info->buffer[2],
> rcvd_info->buffer[3]);
> - wid_id = MAKE_WORD16(rcvd_info->buffer[4],
> rcvd_info->buffer[5]);
> - wid_len = rcvd_info->buffer[6];
>   mac_status  = rcvd_info->buffer[7];
> - mac_status_reason_code = rcvd_info->buffer[8];
> - mac_status_additional_info = rcvd_info->buffer[9];
>   if (hif_drv->hif_state == HOST_IF_WAITING_CONN_RESP)
> { host_int_parse_assoc_resp_info(vif, mac_status);
>   } else if ((mac_status == MAC_STATUS_DISCONNECTED) &&
> diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
> b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index
> 8be3c4c57579..76b4afaef423 100644 ---
> a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++
> b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -917,12
> +917,10 @@ static int add_key(struct wiphy *wiphy, struct net_device
> *netdev, u8 key_index, const u8 *tx_mic = NULL; u8 mode = NO_ENCRYPT;
>   u8 op_mode;
> - struct wilc *wl;
>   struct wilc_vif *vif;
>  
>   priv = wiphy_priv(wiphy);
>   vif = netdev_priv(netdev);
> - wl = vif->wilc;
>  
>   switch (params->cipher) {
>   case WLAN_CIPHER_SUITE_WEP40:
> @@ -1885,12 +1883,10 @@ static int start_ap(struct wiphy *wiphy,
> struct net_device *dev, struct cfg80211_ap_settings *settings)
>  {
>   struct cfg80211_beacon_data *beacon = &settings->beacon;
> - struct wilc_priv *priv;
>   s32 ret = 0;
>   struct wilc *wl;
>   struct wilc_vif *vif;
>  
> - priv = wiphy_priv(wiphy);
>   vif = netdev_priv(dev);
>   wl = vif->wilc;
>  
> @@ -2016,14 +2012,12 @@ static int change_station(struct wiphy
> *wiphy, struct net_device *dev, const u8 *mac, struct
> station_parameters *params) {
>   s32 ret = 0;
> - struct wilc_priv *priv;
>   struct add_sta_param sta_params = { {0} };
>   struct wilc_vif *vif;
>  
>   if (!wiphy)
>   return -EFAULT;
>  
> - priv = wiphy_priv(wiphy);
>   vif = netdev_priv(dev);
>  
>   if (vif->iftype == AP_MODE || vif->iftype == GO_MODE) {



Re: [PATCH 2/3] staging: wilc1000: Remove useless function

2018-05-06 Thread Ajay Singh
On Sun, 6 May 2018 00:33:32 -0700
Nathan Chancellor  wrote:

> GCC warns that 'wid' is unused in wilc_remove_key and it's correct;
> the variable is only local. Get rid of the function (since it just
> returns zero) and shuffle the remaining code into one if statement.
> 
> Signed-off-by: Nathan Chancellor 

Reviewed-by: Ajay Singh 

> ---
>  drivers/staging/wilc1000/host_interface.c | 12 
>  drivers/staging/wilc1000/host_interface.h |  1 -
>  drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 14 +-
>  3 files changed, 5 insertions(+), 22 deletions(-)
> 
> diff --git a/drivers/staging/wilc1000/host_interface.c
> b/drivers/staging/wilc1000/host_interface.c index
> 3fd4c8e62da6..b5f3829e9903 100644 ---
> a/drivers/staging/wilc1000/host_interface.c +++
> b/drivers/staging/wilc1000/host_interface.c @@ -2606,18 +2606,6 @@
> static void timer_connect_cb(struct timer_list *t)
> wilc_enqueue_cmd(&msg); }
>  
> -s32 wilc_remove_key(struct host_if_drv *hif_drv, const u8 *sta_addr)
> -{
> - struct wid wid;
> -
> - wid.id = (u16)WID_REMOVE_KEY;
> - wid.type = WID_STR;
> - wid.val = (s8 *)sta_addr;
> - wid.size = 6;
> -
> - return 0;
> -}
> -
>  int wilc_remove_wep_key(struct wilc_vif *vif, u8 index)
>  {
>   int result = 0;
> diff --git a/drivers/staging/wilc1000/host_interface.h
> b/drivers/staging/wilc1000/host_interface.h index
> 7a26f341e0ba..08b3ba7df8b4 100644 ---
> a/drivers/staging/wilc1000/host_interface.h +++
> b/drivers/staging/wilc1000/host_interface.h @@ -303,7 +303,6 @@
> struct add_sta_param { };
>  
>  struct wilc_vif;
> -s32 wilc_remove_key(struct host_if_drv *hif_drv, const u8 *sta_addr);
>  int wilc_remove_wep_key(struct wilc_vif *vif, u8 index);
>  int wilc_set_wep_default_keyid(struct wilc_vif *vif, u8 index);
>  int wilc_add_wep_key_bss_sta(struct wilc_vif *vif, const u8 *key, u8
> len, diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
> b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index
> 76b4afaef423..b499fb987395 100644 ---
> a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++
> b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -1054,15
> +1054,11 @@ static int del_key(struct wiphy *wiphy, struct net_device
> *netdev, } }
>  
> - if (key_index >= 0 && key_index <= 3) {
> - if (priv->wep_key_len[key_index]) {
> - memset(priv->wep_key[key_index], 0,
> -priv->wep_key_len[key_index]);
> - priv->wep_key_len[key_index] = 0;
> - wilc_remove_wep_key(vif, key_index);
> - }
> - } else {
> - wilc_remove_key(priv->hif_drv, mac_addr);
> + if (key_index >= 0 && key_index <= 3 &&
> priv->wep_key_len[key_index]) {
> + memset(priv->wep_key[key_index], 0,
> +priv->wep_key_len[key_index]);
> + priv->wep_key_len[key_index] = 0;
> + wilc_remove_wep_key(vif, key_index);
>   }
>  
>   return 0;



Re: [PATCH 3/3] staging: wilc1000: Remove unnecessary array index check

2018-05-06 Thread Ajay Singh
On Sun, 6 May 2018 00:33:33 -0700
Nathan Chancellor  wrote:

> This statment triggers GCC's -Wtype-limit since key_index is an
> unsigned integer so it cannot be less than zero.
> 
> Signed-off-by: Nathan Chancellor 

Reviewed-by: Ajay Singh 

> ---
>  drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
> b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index
> b499fb987395..e0015ca6c21a 100644 ---
> a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++
> b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -1054,7
> +1054,7 @@ static int del_key(struct wiphy *wiphy, struct net_device
> *netdev, } }
>  
> - if (key_index >= 0 && key_index <= 3 &&
> priv->wep_key_len[key_index]) {
> + if (key_index <= 3 && priv->wep_key_len[key_index]) {
>   memset(priv->wep_key[key_index], 0,
>  priv->wep_key_len[key_index]);
>   priv->wep_key_len[key_index] = 0;