[PATCH 4/9] staging: rtl8192u: propagate errors in rtl8192_read_eeprom_info

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Propagate error from eprom_read and change the return type of
rtl8192_read_eeprom_info from void to int.

Signed-off-by: Salah Triki <salah.triki@xxxxxxx>
---
 drivers/staging/rtl8192u/r8192U_core.c | 37 +++++++++++++++++-----------------
 1 file changed, 19 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c
index 1c09c61..e7168da 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -2433,7 +2433,7 @@ static inline u16 endian_swap(u16 *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;
 	u8 bMac_Tmp_Addr[6] = {0x00, 0xe0, 0x4c, 0x00, 0x00, 0x02};
@@ -2446,7 +2446,7 @@ static void rtl8192_read_eeprom_info(struct net_device *dev)
 	RT_TRACE(COMP_EPROM, "===========>%s()\n", __func__);
 	ret = eprom_read(dev, 0); /* first read EEPROM ID out; */
 	if (ret)
-		return;
+		return ret;
 	wEPROM_ID = (u16)ret;
 	RT_TRACE(COMP_EPROM, "EEPROM ID is 0x%x\n", wEPROM_ID);
 
@@ -2460,22 +2460,22 @@ static void rtl8192_read_eeprom_info(struct net_device *dev)
 	if (bLoad_From_EEPOM) {
 		ret = eprom_read(dev, EEPROM_VID >> 1);
 		if (ret)
-			return;
+			return ret;
 		tmpValue = (u16)ret;
 		priv->eeprom_vid = endian_swap(&tmpValue);
 		ret = eprom_read(dev, EEPROM_PID >> 1);
 		if (ret)
-			return;
+			return ret;
 		priv->eeprom_pid = (u16)ret;
 		ret = eprom_read(dev, EEPROM_ChannelPlan >> 1);
 		if (ret)
-			return;
+			return ret;
 		tmpValue = (u16)ret;
 		priv->eeprom_ChannelPlan = (tmpValue & 0xff00) >> 8;
 		priv->btxpowerdata_readfromEEPORM = true;
 		ret = eprom_read(dev, (EEPROM_Customer_ID >> 1)) >> 8;
 		if (ret)
-			return;
+			return ret;
 		priv->eeprom_CustomerID = (u16)ret;
 	} else {
 		priv->eeprom_vid = 0;
@@ -2497,7 +2497,7 @@ static void rtl8192_read_eeprom_info(struct net_device *dev)
 			ret = eprom_read(dev,
 					 (u16)((EEPROM_NODE_ADDRESS_BYTE_0 + i) >> 1));
 			if (ret)
-				return;
+				return ret;
 			*(u16 *)(&dev->dev_addr[i]) = (u16)ret;
 		}
 	} else {
@@ -2513,7 +2513,7 @@ static void rtl8192_read_eeprom_info(struct net_device *dev)
 		if (bLoad_From_EEPOM) {
 			ret = eprom_read(dev, (EEPROM_TxPowerDiff >> 1));
 			if (ret)
-				return;
+				return ret;
 			priv->EEPROMTxPowerDiff = ((u16)ret & 0xff00) >> 8;
 		} else {
 			priv->EEPROMTxPowerDiff = EEPROM_Default_TxPower;
@@ -2523,7 +2523,7 @@ static void rtl8192_read_eeprom_info(struct net_device *dev)
 		if (bLoad_From_EEPOM) {
 			ret = eprom_read(dev, (EEPROM_ThermalMeter >> 1));
 			if (ret)
-				return;
+				return ret;
 			priv->EEPROMThermalMeter = (u8)((u16)ret & 0x00ff);
 		} else {
 			priv->EEPROMThermalMeter = EEPROM_Default_ThermalMeter;
@@ -2535,7 +2535,7 @@ static void rtl8192_read_eeprom_info(struct net_device *dev)
 		if (bLoad_From_EEPOM) {
 			ret = eprom_read(dev, (EEPROM_PwDiff >> 1));
 			if (ret)
-				return;
+				return ret;
 			priv->EEPROMPwDiff = ((u16)ret & 0x0f00) >> 8;
 		} else {
 			priv->EEPROMPwDiff = EEPROM_Default_PwDiff;
@@ -2545,7 +2545,7 @@ static void rtl8192_read_eeprom_info(struct net_device *dev)
 		if (bLoad_From_EEPOM) {
 			ret = eprom_read(dev, (EEPROM_CrystalCap >> 1));
 			if (ret)
-				return;
+				return ret;
 			priv->EEPROMCrystalCap = ((u16)ret & 0x0f);
 		} else {
 			priv->EEPROMCrystalCap = EEPROM_Default_CrystalCap;
@@ -2555,7 +2555,7 @@ static void rtl8192_read_eeprom_info(struct net_device *dev)
 		if (bLoad_From_EEPOM) {
 			ret = eprom_read(dev, (EEPROM_TxPwIndex_Ver >> 1));
 			if (ret)
-				return;
+				return ret;
 			priv->EEPROM_Def_Ver = ((u16)ret & 0xff00) >> 8;
 		} else {
 			priv->EEPROM_Def_Ver = 1;
@@ -2568,7 +2568,7 @@ static void rtl8192_read_eeprom_info(struct net_device *dev)
 				ret = eprom_read(dev,
 						 (EEPROM_TxPwIndex_CCK >> 1));
 				if (ret)
-					return;
+					return ret;
 				priv->EEPROMTxPowerLevelCCK = ((u16)ret & 0xff) >> 8;
 			} else {
 				priv->EEPROMTxPowerLevelCCK = 0x10;
@@ -2579,7 +2579,7 @@ static void rtl8192_read_eeprom_info(struct net_device *dev)
 					ret = eprom_read(dev,
 							 (EEPROM_TxPwIndex_OFDM_24G + i) >> 1);
 					if (ret)
-						return;
+						return ret;
 					tmpValue = (u16)ret;
 					if (((EEPROM_TxPwIndex_OFDM_24G + i) % 2) == 0)
 						tmpValue = tmpValue & 0x00ff;
@@ -2596,7 +2596,7 @@ static void rtl8192_read_eeprom_info(struct net_device *dev)
 				ret = eprom_read(dev,
 						 EEPROM_TxPwIndex_CCK_V1 >> 1);
 				if (ret)
-					return;
+					return ret;
 				tmpValue = ((u16)ret & 0xff00) >> 8;
 			} else {
 				tmpValue = 0x10;
@@ -2607,7 +2607,7 @@ static void rtl8192_read_eeprom_info(struct net_device *dev)
 				ret = eprom_read(dev,
 						 (EEPROM_TxPwIndex_CCK_V1 + 2) >> 1);
 				if (ret)
-					return;
+					return ret;
 				tmpValue = (u16)ret;
 			} else {
 				tmpValue = 0x1010;
@@ -2617,7 +2617,7 @@ static void rtl8192_read_eeprom_info(struct net_device *dev)
 				ret = eprom_read(dev,
 						 EEPROM_TxPwIndex_OFDM_24G_V1 >> 1);
 				if (ret)
-					return;
+					return ret;
 				tmpValue = (u16)ret;
 			} else {
 				tmpValue = 0x1010;
@@ -2627,7 +2627,7 @@ static void rtl8192_read_eeprom_info(struct net_device *dev)
 				ret = eprom_read(dev,
 						 (EEPROM_TxPwIndex_OFDM_24G_V1 + 2) >> 1);
 				if (ret)
-					return;
+					return ret;
 				tmpValue = (u16)ret;
 			} else {
 				tmpValue = 0x10;
@@ -2719,6 +2719,7 @@ static void rtl8192_read_eeprom_info(struct net_device *dev)
 	init_rate_adaptive(dev);
 
 	RT_TRACE(COMP_EPROM, "<===========%s()\n", __func__);
+	return 0;
 }
 
 static short rtl8192_get_channel_map(struct net_device *dev)
-- 
1.9.1

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux