git: e606e5d15726 - main - sysctl_dumpentry: move error to inner scope

From: Warner Losh <imp_at_FreeBSD.org>
Date: Tue, 05 Apr 2022 04:33:01 UTC
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=e606e5d1572684b978ca0572da776a597ffe0d94

commit e606e5d1572684b978ca0572da776a597ffe0d94
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2022-04-05 02:38:56 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2022-04-05 04:30:50 +0000

    sysctl_dumpentry: move error to inner scope
    
    Sponsored by:           Netflix
---
 sys/net/rtsock.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c
index c5f842de2b7e..bc35255315b2 100644
--- a/sys/net/rtsock.c
+++ b/sys/net/rtsock.c
@@ -2203,7 +2203,6 @@ sysctl_dumpentry(struct rtentry *rt, void *vw)
 {
 	struct walkarg *w = vw;
 	struct nhop_object *nh;
-	int error = 0;
 
 	NET_EPOCH_ASSERT();
 
@@ -2215,6 +2214,7 @@ sysctl_dumpentry(struct rtentry *rt, void *vw)
 	if (NH_IS_NHGRP(nh)) {
 		struct weightened_nhop *wn;
 		uint32_t num_nhops;
+		int error;
 		wn = nhgrp_get_nhops((struct nhgrp_object *)nh, &num_nhops);
 		for (int i = 0; i < num_nhops; i++) {
 			error = sysctl_dumpnhop(rt, wn[i].nh, wn[i].weight, w);
@@ -2223,7 +2223,7 @@ sysctl_dumpentry(struct rtentry *rt, void *vw)
 		}
 	} else
 #endif
-		error = sysctl_dumpnhop(rt, nh, rt->rt_weight, w);
+		sysctl_dumpnhop(rt, nh, rt->rt_weight, w);
 
 	return (0);
 }