[PATCH] netdevsim: fib: Remove redundant code

Subsystems: netdevsim, networking drivers, the rest

STALE1972d

2 messages, 2 authors, 2021-03-10 · open the first message on its own page

[PATCH] netdevsim: fib: Remove redundant code

From: Jiapeng Chong <hidden>
Date: 2021-03-10 02:36:23

Fix the following coccicheck warnings:

./drivers/net/netdevsim/fib.c:874:5-8: Unneeded variable: "err". Return
"0" on line 889.

Reported-by: Abaci Robot <redacted>
Signed-off-by: Jiapeng Chong <redacted>
---
 drivers/net/netdevsim/fib.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/net/netdevsim/fib.c b/drivers/net/netdevsim/fib.c
index 46fb414..db794f9 100644
--- a/drivers/net/netdevsim/fib.c
+++ b/drivers/net/netdevsim/fib.c
@@ -871,8 +871,6 @@ static int nsim_fib6_event(struct nsim_fib_data *data,
 
 static int nsim_fib_event(struct nsim_fib_event *fib_event)
 {
-	int err = 0;
-
 	switch (fib_event->family) {
 	case AF_INET:
 		nsim_fib4_event(fib_event->data, &fib_event->fen_info,
@@ -886,7 +884,7 @@ static int nsim_fib_event(struct nsim_fib_event *fib_event)
 		break;
 	}
 
-	return err;
+	return 0;
 }
 
 static int nsim_fib4_prepare_event(struct fib_notifier_info *info,
-- 
1.8.3.1

Re: [PATCH] netdevsim: fib: Remove redundant code

From: Ido Schimmel <hidden>
Date: 2021-03-10 10:02:38

On Wed, Mar 10, 2021 at 10:35:27AM +0800, Jiapeng Chong wrote:
quoted hunk
Fix the following coccicheck warnings:

./drivers/net/netdevsim/fib.c:874:5-8: Unneeded variable: "err". Return
"0" on line 889.

Reported-by: Abaci Robot <redacted>
Signed-off-by: Jiapeng Chong <redacted>
---
 drivers/net/netdevsim/fib.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/net/netdevsim/fib.c b/drivers/net/netdevsim/fib.c
index 46fb414..db794f9 100644
--- a/drivers/net/netdevsim/fib.c
+++ b/drivers/net/netdevsim/fib.c
@@ -871,8 +871,6 @@ static int nsim_fib6_event(struct nsim_fib_data *data,
 
 static int nsim_fib_event(struct nsim_fib_event *fib_event)
Can you change to 'static void' ?
quoted hunk
 {
-	int err = 0;
-
 	switch (fib_event->family) {
 	case AF_INET:
 		nsim_fib4_event(fib_event->data, &fib_event->fen_info,
@@ -886,7 +884,7 @@ static int nsim_fib_event(struct nsim_fib_event *fib_event)
 		break;
 	}
 
-	return err;
+	return 0;
 }
 
 static int nsim_fib4_prepare_event(struct fib_notifier_info *info,
-- 
1.8.3.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help