Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1732410 > unrolled thread

[PATCH] tg3: clean up redundant initialization of tnapi

Started byColin King <colin.king@canonical.com>
First post2017-09-14 18:10 +0200
Last post2017-09-14 19:10 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] tg3: clean up redundant initialization of tnapi Colin King <colin.king@canonical.com> - 2017-09-14 18:10 +0200
    Re: [PATCH] tg3: clean up redundant initialization of tnapi David Miller <davem@davemloft.net> - 2017-09-14 19:10 +0200

#1732410 — [PATCH] tg3: clean up redundant initialization of tnapi

FromColin King <colin.king@canonical.com>
Date2017-09-14 18:10 +0200
Subject[PATCH] tg3: clean up redundant initialization of tnapi
Message-ID<upESf-7ea-31@gated-at.bofh.it>
From: Colin Ian King <colin.king@canonical.com>

tnapi is being initialized and then immediately updated and
hence the initialiation is redundant.  Clean up the warning
by moving the declaration and initialization to the inside
of the for-loop.

Cleans up clang scan-build warning:
warning: Value stored to 'tnapi' during its initialization is never read

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/net/ethernet/broadcom/tg3.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index af33dc15c55f..54588809b867 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -11536,11 +11536,11 @@ static int tg3_start(struct tg3 *tp, bool reset_phy, bool test_irq,
 	tg3_napi_enable(tp);
 
 	for (i = 0; i < tp->irq_cnt; i++) {
-		struct tg3_napi *tnapi = &tp->napi[i];
 		err = tg3_request_irq(tp, i);
 		if (err) {
 			for (i--; i >= 0; i--) {
-				tnapi = &tp->napi[i];
+				struct tg3_napi *tnapi = &tp->napi[i];
+
 				free_irq(tnapi->irq_vec, tnapi);
 			}
 			goto out_napi_fini;
-- 
2.14.1

[toc] | [next] | [standalone]


#1732464

FromDavid Miller <davem@davemloft.net>
Date2017-09-14 19:10 +0200
Message-ID<upFOh-7RX-7@gated-at.bofh.it>
In reply to#1732410
From: Colin King <colin.king@canonical.com>
Date: Thu, 14 Sep 2017 17:01:25 +0100

> From: Colin Ian King <colin.king@canonical.com>
> 
> tnapi is being initialized and then immediately updated and
> hence the initialiation is redundant.  Clean up the warning
> by moving the declaration and initialization to the inside
> of the for-loop.
> 
> Cleans up clang scan-build warning:
> warning: Value stored to 'tnapi' during its initialization is never read
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Applied.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web