aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-eeprom.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-eeprom.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-eeprom.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom.c b/drivers/net/wireless/iwlwifi/iwl-eeprom.c
index e3dbd79cd13e..2e8c40576d22 100644
--- a/drivers/net/wireless/iwlwifi/iwl-eeprom.c
+++ b/drivers/net/wireless/iwlwifi/iwl-eeprom.c
@@ -436,7 +436,6 @@ static int iwl_find_otp_image(struct iwl_priv *priv,
436 u16 *validblockaddr) 436 u16 *validblockaddr)
437{ 437{
438 u16 next_link_addr = 0, link_value = 0, valid_addr; 438 u16 next_link_addr = 0, link_value = 0, valid_addr;
439 int ret = 0;
440 int usedblocks = 0; 439 int usedblocks = 0;
441 440
442 /* set addressing mode to absolute to traverse the link list */ 441 /* set addressing mode to absolute to traverse the link list */
@@ -456,29 +455,29 @@ static int iwl_find_otp_image(struct iwl_priv *priv,
456 * check for more block on the link list 455 * check for more block on the link list
457 */ 456 */
458 valid_addr = next_link_addr; 457 valid_addr = next_link_addr;
459 next_link_addr = link_value; 458 next_link_addr = link_value * sizeof(u16);
460 IWL_DEBUG_INFO(priv, "OTP blocks %d addr 0x%x\n", 459 IWL_DEBUG_INFO(priv, "OTP blocks %d addr 0x%x\n",
461 usedblocks, next_link_addr); 460 usedblocks, next_link_addr);
462 if (iwl_read_otp_word(priv, next_link_addr, &link_value)) 461 if (iwl_read_otp_word(priv, next_link_addr, &link_value))
463 return -EINVAL; 462 return -EINVAL;
464 if (!link_value) { 463 if (!link_value) {
465 /* 464 /*
466 * reach the end of link list, 465 * reach the end of link list, return success and
467 * set address point to the starting address 466 * set address point to the starting address
468 * of the image 467 * of the image
469 */ 468 */
470 goto done; 469 *validblockaddr = valid_addr;
470 /* skip first 2 bytes (link list pointer) */
471 *validblockaddr += 2;
472 return 0;
471 } 473 }
472 /* more in the link list, continue */ 474 /* more in the link list, continue */
473 usedblocks++; 475 usedblocks++;
474 } while (usedblocks < priv->cfg->max_ll_items); 476 } while (usedblocks <= priv->cfg->max_ll_items);
475 /* OTP full, use last block */ 477
476 IWL_DEBUG_INFO(priv, "OTP is full, use last block\n"); 478 /* OTP has no valid blocks */
477done: 479 IWL_DEBUG_INFO(priv, "OTP has no valid blocks\n");
478 *validblockaddr = valid_addr; 480 return -EINVAL;
479 /* skip first 2 bytes (link list pointer) */
480 *validblockaddr += 2;
481 return ret;
482} 481}
483 482
484/** 483/**