diff options
author | Tobin C. Harding <me@tobin.cc> | 2017-04-10 13:16:00 +1000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-04-11 16:14:33 +0200 |
commit | eb8c4e546961cbdb7d448458c24dfae9d1622510 (patch) | |
tree | 05537631ee020ece7cee0c47e20d29bc12a50a7e | |
parent | 1e0aa795daf9b7adeb4fccb7394c12e39f31c020 (diff) |
staging: ks7010: remove multi-way decision
Function uses multi-way decision for control flow. Final statement of
function is spin_unlock(). Code can be simplified by adding a goto label
labelling the call to spin_unlock() and jumping to label instead of
using multi-way decision. This allows the code to be indented one
level less which adds to the readability.
Add goto label. Remove multi-way decision by jumping to label. Reduce
indentation in subsequent code. Do not change program logic.
Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/staging/ks7010/ks_hostif.c | 48 |
1 files changed, 25 insertions, 23 deletions
diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c index a505c4ec6f32..597280882dc8 100644 --- a/drivers/staging/ks7010/ks_hostif.c +++ b/drivers/staging/ks7010/ks_hostif.c @@ -2241,36 +2241,38 @@ void hostif_sme_multicast_set(struct ks_wlan_private *priv) hostif_mib_set_request(priv, LOCAL_MULTICAST_FILTER, sizeof(filter_type), MIB_VALUE_TYPE_BOOL, &filter_type); - } else if ((netdev_mc_count(dev) > NIC_MAX_MCAST_LIST) || - (dev->flags & IFF_ALLMULTI)) { + goto spin_unlock; + } + + if ((netdev_mc_count(dev) > NIC_MAX_MCAST_LIST) || + (dev->flags & IFF_ALLMULTI)) { filter_type = cpu_to_le32((uint32_t)MCAST_FILTER_MCASTALL); hostif_mib_set_request(priv, LOCAL_MULTICAST_FILTER, sizeof(filter_type), MIB_VALUE_TYPE_BOOL, &filter_type); - } else { - if (priv->sme_i.sme_flag & SME_MULTICAST) { - mc_count = netdev_mc_count(dev); - netdev_for_each_mc_addr(ha, dev) { - memcpy(&set_address[i * ETH_ALEN], ha->addr, - ETH_ALEN); - i++; - } - priv->sme_i.sme_flag &= ~SME_MULTICAST; - hostif_mib_set_request(priv, LOCAL_MULTICAST_ADDRESS, - (ETH_ALEN * mc_count), - MIB_VALUE_TYPE_OSTRING, - &set_address[0]); - } else { - filter_type = - cpu_to_le32((uint32_t)MCAST_FILTER_MCAST); - priv->sme_i.sme_flag |= SME_MULTICAST; - hostif_mib_set_request(priv, LOCAL_MULTICAST_FILTER, - sizeof(filter_type), - MIB_VALUE_TYPE_BOOL, - &filter_type); + goto spin_unlock; + } + + if (priv->sme_i.sme_flag & SME_MULTICAST) { + mc_count = netdev_mc_count(dev); + netdev_for_each_mc_addr(ha, dev) { + memcpy(&set_address[i * ETH_ALEN], ha->addr, ETH_ALEN); + i++; } + priv->sme_i.sme_flag &= ~SME_MULTICAST; + hostif_mib_set_request(priv, LOCAL_MULTICAST_ADDRESS, + ETH_ALEN * mc_count, + MIB_VALUE_TYPE_OSTRING, + &set_address[0]); + } else { + filter_type = cpu_to_le32((uint32_t)MCAST_FILTER_MCAST); + priv->sme_i.sme_flag |= SME_MULTICAST; + hostif_mib_set_request(priv, LOCAL_MULTICAST_FILTER, + sizeof(filter_type), MIB_VALUE_TYPE_BOOL, + &filter_type); } +spin_unlock: spin_unlock(&priv->multicast_spin); } |