sysctl_dumpentry: move error to inner scope

Sponsored by:		Netflix
This commit is contained in:
Warner Losh 2022-04-04 20:38:56 -06:00
parent 5de5b5a34d
commit e606e5d157

View File

@ -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);
}