Skip to contentSkip to conversation

ath9k: consider return code on ar9300_eeprom_restore_flash

PATCH Superseded Eduardo Abinader 2 participants 2 messages Jul 1, 2016 – Jul 8, 2016 Qualcomm Atheros ATH9K wireless driver

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ath9k: consider return code on ar9300_eeprom_restore_flash

just to comply with current ath9k_hw_nvram_read to return value, hence behaving reacting accordingly.

---
 drivers/net/wireless/ath/ath9k/ar9003_eeprom.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath9k/ar9003_eeprom.c +4 -2
index 5bd2cba..b7dc08e 100644
@@ -3252,7 +3252,8 @@ static int ar9300_eeprom_restore_flash(struct ath_hw *ah, u8 *mptr,
 	int i;
 
 	for (i = 0; i < mdata_size / 2; i++, data++)
-		ath9k_hw_nvram_read(ah, i, data);
+		if (!ath9k_hw_nvram_read(ah, i, data))
+			return -1;
 
 	return 0;
 }
@@ -3282,7 +3283,8 @@ static int ar9300_eeprom_restore_internal(struct ath_hw *ah,
 	if (ath9k_hw_use_flash(ah)) {
 		u8 txrx;
 
-		ar9300_eeprom_restore_flash(ah, mptr, mdata_size);
+		if (ar9300_eeprom_restore_flash(ah, mptr, mdata_size))
+			return -1;
 
 		/* check if eeprom contains valid data */
 		eep = (struct ar9300_eeprom *) mptr;
Signature · 1 line
2.5.0
#1 lore raw

PATCH v2 1/1 ath9k: consider return code on ar9300_eeprom_restore_flash

Quoted 7 lines · Eduardo Abinader

just to comply with current ath9k_hw_nvram_read to return value, hence behaving reacting accordingly.

---
 drivers/net/wireless/ath/ath9k/ar9003_eeprom.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Please always provide a changelog after the "---" line or in the cover letter.

drivers/net/wireless/ath/ath9k/ar9003_eeprom.c static int ar9300_eeprom_restore_flash(struct ath_hw *ah, u8 *mptr, · line 3256

Quoted 11 lines
drivers/net/wireless/ath/ath9k/ar9003_eeprom.c +2 -1
index 5bd2cba..b7dc08e 100644
@@ -3252,7 +3252,8 @@ static int ar9300_eeprom_restore_flash(struct ath_hw *ah, u8 *mptr,
 	int i;
 
 	for (i = 0; i < mdata_size / 2; i++, data++)
-		ath9k_hw_nvram_read(ah, i, data);
+		if (!ath9k_hw_nvram_read(ah, i, data))
+			return -1;

Please use proper error codes, like -EIO or some other.

drivers/net/wireless/ath/ath9k/ar9003_eeprom.c static int ar9300_eeprom_restore_internal(struct ath_hw *ah, · line 3287

Quoted 9 lines
drivers/net/wireless/ath/ath9k/ar9003_eeprom.c +2 -1
 	return 0;
 }
@@ -3282,7 +3283,8 @@ static int ar9300_eeprom_restore_internal(struct ath_hw *ah,
 	if (ath9k_hw_use_flash(ah)) {
 		u8 txrx;
 
-		ar9300_eeprom_restore_flash(ah, mptr, mdata_size);
+		if (ar9300_eeprom_restore_flash(ah, mptr, mdata_size))
+			return -1;

And here you can just return the error code:

	ret = ar9300_eeprom_restore_flash(ah, mptr, mdata_size);
	if (ret)
		return ret;
Signature · 1 line
Kalle Valo