Commit 4d2c9994 authored by Colin Ian King's avatar Colin Ian King Committed by Jakub Kicinski

net: tg3: tidy up loop, remove need to compute off with a multiply

Currently the value for 'off' is computed using a multiplication and
a couple of statements later off is being incremented by len and
this value is never read.  Clean up the code by removing the
multiplication and just increment off by len on each iteration.

Addresses-Coverity: ("Unused value")
Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 9dfff802
...@@ -10797,17 +10797,15 @@ static int tg3_init_hw(struct tg3 *tp, bool reset_phy) ...@@ -10797,17 +10797,15 @@ static int tg3_init_hw(struct tg3 *tp, bool reset_phy)
#ifdef CONFIG_TIGON3_HWMON #ifdef CONFIG_TIGON3_HWMON
static void tg3_sd_scan_scratchpad(struct tg3 *tp, struct tg3_ocir *ocir) static void tg3_sd_scan_scratchpad(struct tg3 *tp, struct tg3_ocir *ocir)
{ {
u32 off, len = TG3_OCIR_LEN;
int i; int i;
for (i = 0; i < TG3_SD_NUM_RECS; i++, ocir++) { for (i = 0, off = 0; i < TG3_SD_NUM_RECS; i++, ocir++, off += len) {
u32 off = i * TG3_OCIR_LEN, len = TG3_OCIR_LEN;
tg3_ape_scratchpad_read(tp, (u32 *) ocir, off, len); tg3_ape_scratchpad_read(tp, (u32 *) ocir, off, len);
off += len;
if (ocir->signature != TG3_OCIR_SIG_MAGIC || if (ocir->signature != TG3_OCIR_SIG_MAGIC ||
!(ocir->version_flags & TG3_OCIR_FLAG_ACTIVE)) !(ocir->version_flags & TG3_OCIR_FLAG_ACTIVE))
memset(ocir, 0, TG3_OCIR_LEN); memset(ocir, 0, len);
} }
} }
......
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