Commit d74d0899 authored by Sergio Paracuellos's avatar Sergio Paracuellos Committed by Greg Kroah-Hartman

staging: ks7010: refactor LOCAL_EEPROM_SUM case in hostif_mib_get_confirm

This commit simplify conditional paths in LOCAL_EEPROM_SUM case
inside hostif_mib_get_confirm function. It change logic to handle
invalid values first and assign good ones at the end if it is the
case.
Signed-off-by: default avatarSergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 5089cd41
...@@ -504,18 +504,15 @@ void hostif_mib_get_confirm(struct ks_wlan_private *priv) ...@@ -504,18 +504,15 @@ void hostif_mib_get_confirm(struct ks_wlan_private *priv)
break; break;
case LOCAL_EEPROM_SUM: case LOCAL_EEPROM_SUM:
memcpy(&priv->eeprom_sum, priv->rxp, sizeof(priv->eeprom_sum)); memcpy(&priv->eeprom_sum, priv->rxp, sizeof(priv->eeprom_sum));
if (priv->eeprom_sum.type == 0) { if (priv->eeprom_sum.type != 0 &&
priv->eeprom_checksum = EEPROM_CHECKSUM_NONE; priv->eeprom_sum.type != 1) {
} else if (priv->eeprom_sum.type == 1) {
if (priv->eeprom_sum.result == 0) {
priv->eeprom_checksum = EEPROM_NG;
netdev_info(dev, "LOCAL_EEPROM_SUM NG\n");
} else if (priv->eeprom_sum.result == 1) {
priv->eeprom_checksum = EEPROM_OK;
}
} else {
netdev_err(dev, "LOCAL_EEPROM_SUM error!\n"); netdev_err(dev, "LOCAL_EEPROM_SUM error!\n");
return;
} }
priv->eeprom_checksum = (priv->eeprom_sum.type == 0) ?
EEPROM_CHECKSUM_NONE :
(priv->eeprom_sum.result == 0) ?
EEPROM_NG : EEPROM_OK;
break; break;
default: default:
netdev_err(priv->net_dev, "mib_attribute=%08x\n", netdev_err(priv->net_dev, "mib_attribute=%08x\n",
......
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