Commit f6c47702 authored by Jakub Sitnicki's avatar Jakub Sitnicki Committed by Kalle Valo

rtl8xxxu: Don't check for illegal offset when reading from efuse

It is enough to check for either illegal offset or illegal map address
because map address is a value derived from an offset:

  map_addr = offset * 8
  EFUSE_MAP_LEN = EFUSE_MAX_SECTION_8723A * 8

Leave just the check for an illegal map address because its upper
bound (EFUSE_MAP_LEN) is used also in a couple other places.
Signed-off-by: default avatarJakub Sitnicki <jsitnicki@gmail.com>
Signed-off-by: default avatarJes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent d940c247
......@@ -2417,6 +2417,8 @@ static int rtl8xxxu_read_efuse(struct rtl8xxxu_priv *priv)
efuse_addr = 0;
while (efuse_addr < EFUSE_REAL_CONTENT_LEN_8723A) {
u16 map_addr;
ret = rtl8xxxu_read_efuse8(priv, efuse_addr++, &header);
if (ret || header == 0xff)
goto exit;
......@@ -2439,8 +2441,6 @@ static int rtl8xxxu_read_efuse(struct rtl8xxxu_priv *priv)
word_mask = header & 0x0f;
}
if (offset < EFUSE_MAX_SECTION_8723A) {
u16 map_addr;
/* Get word enable value from PG header */
/* We have 8 bits to indicate validity */
......@@ -2471,13 +2471,6 @@ static int rtl8xxxu_read_efuse(struct rtl8xxxu_priv *priv)
} else
map_addr += 2;
}
} else {
dev_warn(dev,
"%s: Illegal offset (%04x), efuse corrupt!\n",
__func__, offset);
ret = -EINVAL;
goto exit;
}
}
exit:
......
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