Skip to content

Commit eb8c4e5

Browse files
tchardinggregkh
authored andcommitted
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 <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 1e0aa79 commit eb8c4e5

File tree

1 file changed

+25
-23
lines changed

1 file changed

+25
-23
lines changed

drivers/staging/ks7010/ks_hostif.c

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2241,36 +2241,38 @@ void hostif_sme_multicast_set(struct ks_wlan_private *priv)
22412241
hostif_mib_set_request(priv, LOCAL_MULTICAST_FILTER,
22422242
sizeof(filter_type), MIB_VALUE_TYPE_BOOL,
22432243
&filter_type);
2244-
} else if ((netdev_mc_count(dev) > NIC_MAX_MCAST_LIST) ||
2245-
(dev->flags & IFF_ALLMULTI)) {
2244+
goto spin_unlock;
2245+
}
2246+
2247+
if ((netdev_mc_count(dev) > NIC_MAX_MCAST_LIST) ||
2248+
(dev->flags & IFF_ALLMULTI)) {
22462249
filter_type = cpu_to_le32((uint32_t)MCAST_FILTER_MCASTALL);
22472250
hostif_mib_set_request(priv, LOCAL_MULTICAST_FILTER,
22482251
sizeof(filter_type), MIB_VALUE_TYPE_BOOL,
22492252
&filter_type);
2250-
} else {
2251-
if (priv->sme_i.sme_flag & SME_MULTICAST) {
2252-
mc_count = netdev_mc_count(dev);
2253-
netdev_for_each_mc_addr(ha, dev) {
2254-
memcpy(&set_address[i * ETH_ALEN], ha->addr,
2255-
ETH_ALEN);
2256-
i++;
2257-
}
2258-
priv->sme_i.sme_flag &= ~SME_MULTICAST;
2259-
hostif_mib_set_request(priv, LOCAL_MULTICAST_ADDRESS,
2260-
(ETH_ALEN * mc_count),
2261-
MIB_VALUE_TYPE_OSTRING,
2262-
&set_address[0]);
2263-
} else {
2264-
filter_type =
2265-
cpu_to_le32((uint32_t)MCAST_FILTER_MCAST);
2266-
priv->sme_i.sme_flag |= SME_MULTICAST;
2267-
hostif_mib_set_request(priv, LOCAL_MULTICAST_FILTER,
2268-
sizeof(filter_type),
2269-
MIB_VALUE_TYPE_BOOL,
2270-
&filter_type);
2253+
goto spin_unlock;
2254+
}
2255+
2256+
if (priv->sme_i.sme_flag & SME_MULTICAST) {
2257+
mc_count = netdev_mc_count(dev);
2258+
netdev_for_each_mc_addr(ha, dev) {
2259+
memcpy(&set_address[i * ETH_ALEN], ha->addr, ETH_ALEN);
2260+
i++;
22712261
}
2262+
priv->sme_i.sme_flag &= ~SME_MULTICAST;
2263+
hostif_mib_set_request(priv, LOCAL_MULTICAST_ADDRESS,
2264+
ETH_ALEN * mc_count,
2265+
MIB_VALUE_TYPE_OSTRING,
2266+
&set_address[0]);
2267+
} else {
2268+
filter_type = cpu_to_le32((uint32_t)MCAST_FILTER_MCAST);
2269+
priv->sme_i.sme_flag |= SME_MULTICAST;
2270+
hostif_mib_set_request(priv, LOCAL_MULTICAST_FILTER,
2271+
sizeof(filter_type), MIB_VALUE_TYPE_BOOL,
2272+
&filter_type);
22722273
}
22732274

2275+
spin_unlock:
22742276
spin_unlock(&priv->multicast_spin);
22752277
}
22762278

0 commit comments

Comments
 (0)