Commit f79a8a85 authored by Ajay Singh's avatar Ajay Singh Committed by Greg Kroah-Hartman

staging: wilc1000: remove unnecessary always true 'if' conditions

Remove the unnecessary always true 'if' conditions and simiplifed the
logic as suggested in [1].

[1]. https://lore.kernel.org/linux-wireless/20200302092346.GA24308@kadam/Suggested-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarAjay Singh <ajay.kathat@microchip.com>
Link: https://lore.kernel.org/r/20200302162226.4196-3-ajay.kathat@microchip.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent efabc44b
...@@ -888,7 +888,6 @@ static int del_pmksa(struct wiphy *wiphy, struct net_device *netdev, ...@@ -888,7 +888,6 @@ static int del_pmksa(struct wiphy *wiphy, struct net_device *netdev,
struct cfg80211_pmksa *pmksa) struct cfg80211_pmksa *pmksa)
{ {
u32 i; u32 i;
int ret = 0;
struct wilc_vif *vif = netdev_priv(netdev); struct wilc_vif *vif = netdev_priv(netdev);
struct wilc_priv *priv = &vif->priv; struct wilc_priv *priv = &vif->priv;
...@@ -901,21 +900,20 @@ static int del_pmksa(struct wiphy *wiphy, struct net_device *netdev, ...@@ -901,21 +900,20 @@ static int del_pmksa(struct wiphy *wiphy, struct net_device *netdev,
} }
} }
if (i < priv->pmkid_list.numpmkid && priv->pmkid_list.numpmkid > 0) { if (i == priv->pmkid_list.numpmkid)
for (; i < (priv->pmkid_list.numpmkid - 1); i++) { return -EINVAL;
memcpy(priv->pmkid_list.pmkidlist[i].bssid,
priv->pmkid_list.pmkidlist[i + 1].bssid, for (; i < (priv->pmkid_list.numpmkid - 1); i++) {
ETH_ALEN); memcpy(priv->pmkid_list.pmkidlist[i].bssid,
memcpy(priv->pmkid_list.pmkidlist[i].pmkid, priv->pmkid_list.pmkidlist[i + 1].bssid,
priv->pmkid_list.pmkidlist[i + 1].pmkid, ETH_ALEN);
WLAN_PMKID_LEN); memcpy(priv->pmkid_list.pmkidlist[i].pmkid,
} priv->pmkid_list.pmkidlist[i + 1].pmkid,
priv->pmkid_list.numpmkid--; WLAN_PMKID_LEN);
} else {
ret = -EINVAL;
} }
priv->pmkid_list.numpmkid--;
return ret; return 0;
} }
static int flush_pmksa(struct wiphy *wiphy, struct net_device *netdev) static int flush_pmksa(struct wiphy *wiphy, struct net_device *netdev)
......
...@@ -703,10 +703,8 @@ static void wilc_wlan_handle_rx_buff(struct wilc *wilc, u8 *buffer, int size) ...@@ -703,10 +703,8 @@ static void wilc_wlan_handle_rx_buff(struct wilc *wilc, u8 *buffer, int size)
wilc_wfi_mgmt_rx(wilc, buff_ptr, pkt_len); wilc_wfi_mgmt_rx(wilc, buff_ptr, pkt_len);
} else { } else {
if (!is_cfg_packet) { if (!is_cfg_packet) {
if (pkt_len > 0) { wilc_frmw_to_host(wilc, buff_ptr, pkt_len,
wilc_frmw_to_host(wilc, buff_ptr, pkt_offset);
pkt_len, pkt_offset);
}
} else { } else {
struct wilc_cfg_rsp rsp; struct wilc_cfg_rsp rsp;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment