Commit eafe8261 authored by Salah Triki's avatar Salah Triki Committed by Greg Kroah-Hartman

staging: rtl8192u: propagate errors in rtl8192_read_eeprom_info

Propagate error from eprom_read and change the return type of
rtl8192_read_eeprom_info from void to int.
Signed-off-by: default avatarSalah Triki <salah.triki@acm.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 16feab64
...@@ -2421,7 +2421,7 @@ static inline u16 endian_swap(u16 *data) ...@@ -2421,7 +2421,7 @@ static inline u16 endian_swap(u16 *data)
return *data; return *data;
} }
static void rtl8192_read_eeprom_info(struct net_device *dev) static int rtl8192_read_eeprom_info(struct net_device *dev)
{ {
u16 wEPROM_ID = 0; u16 wEPROM_ID = 0;
u8 bMac_Tmp_Addr[6] = {0x00, 0xe0, 0x4c, 0x00, 0x00, 0x02}; u8 bMac_Tmp_Addr[6] = {0x00, 0xe0, 0x4c, 0x00, 0x00, 0x02};
...@@ -2434,7 +2434,7 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) ...@@ -2434,7 +2434,7 @@ static void rtl8192_read_eeprom_info(struct net_device *dev)
RT_TRACE(COMP_EPROM, "===========>%s()\n", __func__); RT_TRACE(COMP_EPROM, "===========>%s()\n", __func__);
ret = eprom_read(dev, 0); /* first read EEPROM ID out; */ ret = eprom_read(dev, 0); /* first read EEPROM ID out; */
if (ret < 0) if (ret < 0)
return; return ret;
wEPROM_ID = (u16)ret; wEPROM_ID = (u16)ret;
RT_TRACE(COMP_EPROM, "EEPROM ID is 0x%x\n", wEPROM_ID); RT_TRACE(COMP_EPROM, "EEPROM ID is 0x%x\n", wEPROM_ID);
...@@ -2449,22 +2449,22 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) ...@@ -2449,22 +2449,22 @@ static void rtl8192_read_eeprom_info(struct net_device *dev)
tmpValue = eprom_read(dev, EEPROM_VID >> 1); tmpValue = eprom_read(dev, EEPROM_VID >> 1);
ret = eprom_read(dev, EEPROM_VID >> 1); ret = eprom_read(dev, EEPROM_VID >> 1);
if (ret < 0) if (ret < 0)
return; return ret;
tmpValue = (u16)ret; tmpValue = (u16)ret;
priv->eeprom_vid = endian_swap(&tmpValue); priv->eeprom_vid = endian_swap(&tmpValue);
ret = eprom_read(dev, EEPROM_PID >> 1); ret = eprom_read(dev, EEPROM_PID >> 1);
if (ret < 0) if (ret < 0)
return; return ret;
priv->eeprom_pid = (u16)ret; priv->eeprom_pid = (u16)ret;
ret = eprom_read(dev, EEPROM_ChannelPlan >> 1); ret = eprom_read(dev, EEPROM_ChannelPlan >> 1);
if (ret < 0) if (ret < 0)
return; return ret;
tmpValue = (u16)ret; tmpValue = (u16)ret;
priv->eeprom_ChannelPlan = (tmpValue & 0xff00) >> 8; priv->eeprom_ChannelPlan = (tmpValue & 0xff00) >> 8;
priv->btxpowerdata_readfromEEPORM = true; priv->btxpowerdata_readfromEEPORM = true;
ret = eprom_read(dev, (EEPROM_Customer_ID >> 1)) >> 8; ret = eprom_read(dev, (EEPROM_Customer_ID >> 1)) >> 8;
if (ret < 0) if (ret < 0)
return; return ret;
priv->eeprom_CustomerID = (u16)ret; priv->eeprom_CustomerID = (u16)ret;
} else { } else {
priv->eeprom_vid = 0; priv->eeprom_vid = 0;
...@@ -2485,7 +2485,7 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) ...@@ -2485,7 +2485,7 @@ static void rtl8192_read_eeprom_info(struct net_device *dev)
for (i = 0; i < 6; i += 2) { for (i = 0; i < 6; i += 2) {
ret = eprom_read(dev, (u16)((EEPROM_NODE_ADDRESS_BYTE_0 + i) >> 1)); ret = eprom_read(dev, (u16)((EEPROM_NODE_ADDRESS_BYTE_0 + i) >> 1));
if (ret < 0) if (ret < 0)
return; return ret;
*(u16 *)(&dev->dev_addr[i]) = (u16)ret; *(u16 *)(&dev->dev_addr[i]) = (u16)ret;
} }
} else { } else {
...@@ -2501,7 +2501,7 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) ...@@ -2501,7 +2501,7 @@ static void rtl8192_read_eeprom_info(struct net_device *dev)
if (bLoad_From_EEPOM) { if (bLoad_From_EEPOM) {
ret = eprom_read(dev, (EEPROM_TxPowerDiff >> 1)); ret = eprom_read(dev, (EEPROM_TxPowerDiff >> 1));
if (ret < 0) if (ret < 0)
return; return ret;
priv->EEPROMTxPowerDiff = ((u16)ret & 0xff00) >> 8; priv->EEPROMTxPowerDiff = ((u16)ret & 0xff00) >> 8;
} else } else
priv->EEPROMTxPowerDiff = EEPROM_Default_TxPower; priv->EEPROMTxPowerDiff = EEPROM_Default_TxPower;
...@@ -2510,7 +2510,7 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) ...@@ -2510,7 +2510,7 @@ static void rtl8192_read_eeprom_info(struct net_device *dev)
if (bLoad_From_EEPOM) { if (bLoad_From_EEPOM) {
ret = eprom_read(dev, (EEPROM_ThermalMeter >> 1)); ret = eprom_read(dev, (EEPROM_ThermalMeter >> 1));
if (ret < 0) if (ret < 0)
return; return ret;
priv->EEPROMThermalMeter = (u8)((u16)ret & 0x00ff); priv->EEPROMThermalMeter = (u8)((u16)ret & 0x00ff);
} else } else
priv->EEPROMThermalMeter = EEPROM_Default_ThermalMeter; priv->EEPROMThermalMeter = EEPROM_Default_ThermalMeter;
...@@ -2521,7 +2521,7 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) ...@@ -2521,7 +2521,7 @@ static void rtl8192_read_eeprom_info(struct net_device *dev)
if (bLoad_From_EEPOM) { if (bLoad_From_EEPOM) {
ret = eprom_read(dev, (EEPROM_PwDiff >> 1)); ret = eprom_read(dev, (EEPROM_PwDiff >> 1));
if (ret < 0) if (ret < 0)
return; return ret;
priv->EEPROMPwDiff = ((u16)ret & 0x0f00) >> 8; priv->EEPROMPwDiff = ((u16)ret & 0x0f00) >> 8;
} else } else
priv->EEPROMPwDiff = EEPROM_Default_PwDiff; priv->EEPROMPwDiff = EEPROM_Default_PwDiff;
...@@ -2530,7 +2530,7 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) ...@@ -2530,7 +2530,7 @@ static void rtl8192_read_eeprom_info(struct net_device *dev)
if (bLoad_From_EEPOM) { if (bLoad_From_EEPOM) {
ret = eprom_read(dev, (EEPROM_CrystalCap >> 1)); ret = eprom_read(dev, (EEPROM_CrystalCap >> 1));
if (ret < 0) if (ret < 0)
return; return ret;
priv->EEPROMCrystalCap = (u16)ret & 0x0f; priv->EEPROMCrystalCap = (u16)ret & 0x0f;
} else } else
priv->EEPROMCrystalCap = EEPROM_Default_CrystalCap; priv->EEPROMCrystalCap = EEPROM_Default_CrystalCap;
...@@ -2539,7 +2539,7 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) ...@@ -2539,7 +2539,7 @@ static void rtl8192_read_eeprom_info(struct net_device *dev)
if (bLoad_From_EEPOM) { if (bLoad_From_EEPOM) {
ret = eprom_read(dev, (EEPROM_TxPwIndex_Ver >> 1)); ret = eprom_read(dev, (EEPROM_TxPwIndex_Ver >> 1));
if (ret < 0) if (ret < 0)
return; return ret;
priv->EEPROM_Def_Ver = ((u16)ret & 0xff00) >> 8; priv->EEPROM_Def_Ver = ((u16)ret & 0xff00) >> 8;
} else } else
priv->EEPROM_Def_Ver = 1; priv->EEPROM_Def_Ver = 1;
...@@ -2550,7 +2550,7 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) ...@@ -2550,7 +2550,7 @@ static void rtl8192_read_eeprom_info(struct net_device *dev)
if (bLoad_From_EEPOM) { if (bLoad_From_EEPOM) {
ret = eprom_read(dev, (EEPROM_TxPwIndex_CCK >> 1)); ret = eprom_read(dev, (EEPROM_TxPwIndex_CCK >> 1));
if (ret < 0) if (ret < 0)
return; return ret;
priv->EEPROMTxPowerLevelCCK = ((u16)ret & 0xff) >> 8; priv->EEPROMTxPowerLevelCCK = ((u16)ret & 0xff) >> 8;
} else } else
priv->EEPROMTxPowerLevelCCK = 0x10; priv->EEPROMTxPowerLevelCCK = 0x10;
...@@ -2559,7 +2559,7 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) ...@@ -2559,7 +2559,7 @@ static void rtl8192_read_eeprom_info(struct net_device *dev)
if (bLoad_From_EEPOM) { if (bLoad_From_EEPOM) {
ret = eprom_read(dev, (EEPROM_TxPwIndex_OFDM_24G + i) >> 1); ret = eprom_read(dev, (EEPROM_TxPwIndex_OFDM_24G + i) >> 1);
if ( ret < 0) if ( ret < 0)
return; return ret;
if (((EEPROM_TxPwIndex_OFDM_24G + i) % 2) == 0) if (((EEPROM_TxPwIndex_OFDM_24G + i) % 2) == 0)
tmpValue = (u16)ret & 0x00ff; tmpValue = (u16)ret & 0x00ff;
else else
...@@ -2574,7 +2574,7 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) ...@@ -2574,7 +2574,7 @@ static void rtl8192_read_eeprom_info(struct net_device *dev)
if (bLoad_From_EEPOM) { if (bLoad_From_EEPOM) {
ret = eprom_read(dev, EEPROM_TxPwIndex_CCK_V1 >> 1); ret = eprom_read(dev, EEPROM_TxPwIndex_CCK_V1 >> 1);
if (ret < 0) if (ret < 0)
return; return ret;
tmpValue = ((u16)ret & 0xff00) >> 8; tmpValue = ((u16)ret & 0xff00) >> 8;
} else { } else {
tmpValue = 0x10; tmpValue = 0x10;
...@@ -2584,7 +2584,7 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) ...@@ -2584,7 +2584,7 @@ static void rtl8192_read_eeprom_info(struct net_device *dev)
if (bLoad_From_EEPOM) { if (bLoad_From_EEPOM) {
ret = eprom_read(dev, (EEPROM_TxPwIndex_CCK_V1 + 2) >> 1); ret = eprom_read(dev, (EEPROM_TxPwIndex_CCK_V1 + 2) >> 1);
if (ret < 0) if (ret < 0)
return; return ret;
tmpValue = (u16)ret; tmpValue = (u16)ret;
} else } else
tmpValue = 0x1010; tmpValue = 0x1010;
...@@ -2684,6 +2684,8 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) ...@@ -2684,6 +2684,8 @@ static void rtl8192_read_eeprom_info(struct net_device *dev)
init_rate_adaptive(dev); init_rate_adaptive(dev);
RT_TRACE(COMP_EPROM, "<===========%s()\n", __func__); RT_TRACE(COMP_EPROM, "<===========%s()\n", __func__);
return 0;
} }
static short rtl8192_get_channel_map(struct net_device *dev) static short rtl8192_get_channel_map(struct net_device *dev)
......
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