Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp125768ybk; Fri, 8 May 2020 15:55:22 -0700 (PDT) X-Google-Smtp-Source: APiQypKl6bv1MOFzkHvfPYOLp7jhzM0OIvlkADKcqQZg7retJSP8T9B6WMBn5lvTjLkd+B9YmmAv X-Received: by 2002:a17:906:5004:: with SMTP id s4mr4052993ejj.13.1588978521895; Fri, 08 May 2020 15:55:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588978521; cv=none; d=google.com; s=arc-20160816; b=VaFDbcftjlchN55EXQ7rpi8r7mNoAuq1Y04FB4Sqxv5/mal53GuDntSWf8wW8v5zia BaYrFldJANy8bA/5qh2F8uKjj/9gk5kQBH+Ppy5321eFpA/dKPo1uSfNOCK19yfE9um8 8u17UnERkn0rjBce3GqLYueXfVnuW8gidL5sEMaY5piyUWXOvHOYqNbEDEu697Duvwbz o4z2dJyCZ+RDNrYx/Bwd+dKLNkOOLs5Bl6CnnQ/zuuX3iMPxh7GTZwFtAj2KM1TI0bAz V4+YnDG2d0PhuqRqJ0WKQtNnMdIDnAZl7BJQPpT7TzTMBW2aHzT+A/kFHel6+xfzXQXO +tzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=gxyxrc9xVj6qXBaRXCdD+/EuWNQcwYkwuqhNxp1iokQ=; b=ULm7ZK36d3+uhuMqRlldmKTLN6e0lbtkoLiJiH2mr4A5rIztML6KY5TzW5Fgu/TfW8 /8cj5dr0ln206jE4UuJ1lz7bIDR/FJaMegk9Af+DRlNZLDXsHJXO5M47ykaEsmwZJh/r jvaMbSLMy/ZDHv5rxDPd+1bEVirlbi4OFsx1S+37HRgMO7Fp2/i5uyfRos9eRptLOWq+ EdyhRyypM5tsCU+pQpzGfGVZvF26yD8jDIE0zSB0GuvAXKO1bofwlk4esy+sr9dPZQM0 kHBeOKyOtMgvWV30TnuVL6Xx25cRWDmyW1N5y4gLz+zpNJghk85lQODTrRanO2lfPGrf /t6A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w18si1806348edr.474.2020.05.08.15.54.59; Fri, 08 May 2020 15:55:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728305AbgEHWxE (ORCPT + 99 others); Fri, 8 May 2020 18:53:04 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:54023 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727110AbgEHWxE (ORCPT ); Fri, 8 May 2020 18:53:04 -0400 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1jXBrZ-0002Yc-W6; Fri, 08 May 2020 22:53:02 +0000 From: Colin King To: Siva Reddy Kallam , Prashant Sreedharan , Michael Chan , "David S . Miller" , netdev@vger.kernel.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] net: tg3: tidy up loop, remove need to compute off with a multiply Date: Fri, 8 May 2020 23:53:01 +0100 Message-Id: <20200508225301.484094-1-colin.king@canonical.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Colin Ian King 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. Also use len instead of TG3_OCIR_LEN. Addresses-Coverity: ("Unused value") Signed-off-by: Colin Ian King --- drivers/net/ethernet/broadcom/tg3.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index ff98a82b7bc4..9dd9bd506bcc 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c @@ -10798,16 +10798,14 @@ static int tg3_init_hw(struct tg3 *tp, bool reset_phy) static void tg3_sd_scan_scratchpad(struct tg3 *tp, struct tg3_ocir *ocir) { int i; + u32 off, len = TG3_OCIR_LEN; - for (i = 0; i < TG3_SD_NUM_RECS; i++, ocir++) { - u32 off = i * TG3_OCIR_LEN, len = TG3_OCIR_LEN; - + for (i = 0, off = 0; i < TG3_SD_NUM_RECS; i++, ocir++, off += len) { tg3_ape_scratchpad_read(tp, (u32 *) ocir, off, len); - off += len; if (ocir->signature != TG3_OCIR_SIG_MAGIC || !(ocir->version_flags & TG3_OCIR_FLAG_ACTIVE)) - memset(ocir, 0, TG3_OCIR_LEN); + memset(ocir, 0, len); } } -- 2.25.1