diff options
author | Sergio Paracuellos <sergio.paracuellos@gmail.com> | 2018-05-04 06:16:46 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-05-06 18:58:41 -0700 |
commit | d74d0899349221b4356545ba88e4d0882d049d2f (patch) | |
tree | 3e22e5270ccecc17058fc81f1487096ac931ec15 /drivers/staging/ks7010 | |
parent | 5089cd418962823ff3a1ed1a0ec6a7d764fac27b (diff) | |
download | linux-d74d0899349221b4356545ba88e4d0882d049d2f.tar.gz linux-d74d0899349221b4356545ba88e4d0882d049d2f.tar.bz2 linux-d74d0899349221b4356545ba88e4d0882d049d2f.zip |
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: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/ks7010')
-rw-r--r-- | drivers/staging/ks7010/ks_hostif.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c index 7a511231225f..3db5679cdaf5 100644 --- a/drivers/staging/ks7010/ks_hostif.c +++ b/drivers/staging/ks7010/ks_hostif.c @@ -504,18 +504,15 @@ void hostif_mib_get_confirm(struct ks_wlan_private *priv) break; case LOCAL_EEPROM_SUM: memcpy(&priv->eeprom_sum, priv->rxp, sizeof(priv->eeprom_sum)); - if (priv->eeprom_sum.type == 0) { - priv->eeprom_checksum = EEPROM_CHECKSUM_NONE; - } 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 { + if (priv->eeprom_sum.type != 0 && + priv->eeprom_sum.type != 1) { 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; default: netdev_err(priv->net_dev, "mib_attribute=%08x\n", |