From f79a8a85cc5294733724f48cfc1fc167622e513b Mon Sep 17 00:00:00 2001 From: Ajay Singh Date: Mon, 2 Mar 2020 16:22:35 +0000 Subject: [PATCH] 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: Dan Carpenter Signed-off-by: Ajay Singh Link: https://lore.kernel.org/r/20200302162226.4196-3-ajay.kathat@microchip.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/cfg80211.c | 26 ++++++++++++-------------- drivers/staging/wilc1000/wlan.c | 6 ++---- 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/drivers/staging/wilc1000/cfg80211.c b/drivers/staging/wilc1000/cfg80211.c index 5d8faa01337d..54e02807cebf 100644 --- a/drivers/staging/wilc1000/cfg80211.c +++ b/drivers/staging/wilc1000/cfg80211.c @@ -888,7 +888,6 @@ static int del_pmksa(struct wiphy *wiphy, struct net_device *netdev, struct cfg80211_pmksa *pmksa) { u32 i; - int ret = 0; struct wilc_vif *vif = netdev_priv(netdev); struct wilc_priv *priv = &vif->priv; @@ -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) { - for (; i < (priv->pmkid_list.numpmkid - 1); i++) { - memcpy(priv->pmkid_list.pmkidlist[i].bssid, - priv->pmkid_list.pmkidlist[i + 1].bssid, - ETH_ALEN); - memcpy(priv->pmkid_list.pmkidlist[i].pmkid, - priv->pmkid_list.pmkidlist[i + 1].pmkid, - WLAN_PMKID_LEN); - } - priv->pmkid_list.numpmkid--; - } else { - ret = -EINVAL; + if (i == priv->pmkid_list.numpmkid) + return -EINVAL; + + for (; i < (priv->pmkid_list.numpmkid - 1); i++) { + memcpy(priv->pmkid_list.pmkidlist[i].bssid, + priv->pmkid_list.pmkidlist[i + 1].bssid, + ETH_ALEN); + memcpy(priv->pmkid_list.pmkidlist[i].pmkid, + priv->pmkid_list.pmkidlist[i + 1].pmkid, + WLAN_PMKID_LEN); } + priv->pmkid_list.numpmkid--; - return ret; + return 0; } static int flush_pmksa(struct wiphy *wiphy, struct net_device *netdev) diff --git a/drivers/staging/wilc1000/wlan.c b/drivers/staging/wilc1000/wlan.c index 3aeca882f431..6a82fb2f283e 100644 --- a/drivers/staging/wilc1000/wlan.c +++ b/drivers/staging/wilc1000/wlan.c @@ -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); } else { if (!is_cfg_packet) { - if (pkt_len > 0) { - wilc_frmw_to_host(wilc, buff_ptr, - pkt_len, pkt_offset); - } + wilc_frmw_to_host(wilc, buff_ptr, pkt_len, + pkt_offset); } else { struct wilc_cfg_rsp rsp; -- 2.30.2