This commits refactor a bit hostif_sme_set_pmksa function: - avoid one level indentation changing if condition. - use ether_addr_copy to copy bssid addresses. - move 'i' initialization to declaration place. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@xxxxxxxxx> --- drivers/staging/ks7010/ks_hostif.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c index 3abdba6..61d9742 100644 --- a/drivers/staging/ks7010/ks_hostif.c +++ b/drivers/staging/ks7010/ks_hostif.c @@ -2056,16 +2056,14 @@ void hostif_sme_set_pmksa(struct ks_wlan_private *priv) } __packed list[PMK_LIST_MAX]; } __packed pmkcache; struct pmk *pmk; - int i; + int i = 0; - i = 0; list_for_each_entry(pmk, &priv->pmklist.head, list) { - if (i < PMK_LIST_MAX) { - memcpy(pmkcache.list[i].bssid, pmk->bssid, ETH_ALEN); - memcpy(pmkcache.list[i].pmkid, pmk->pmkid, - IW_PMKID_LEN); - i++; - } + if (i >= PMK_LIST_MAX) + break; + ether_addr_copy(pmkcache.list[i].bssid, pmk->bssid); + memcpy(pmkcache.list[i].pmkid, pmk->pmkid, IW_PMKID_LEN); + i++; } pmkcache.size = cpu_to_le16((uint16_t)(priv->pmklist.size)); hostif_mib_set_request(priv, LOCAL_PMK, -- 2.7.4 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel