Skip to contentSkip to conversation

nexthop: simplify code in nh_valid_get_bucket_req

PATCH In review [email protected] 3 participants 3 messages Sep 17, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nexthop: simplify code in nh_valid_get_bucket_req

From: William Dean <[email protected]>

It could directly return 'nh_valid_get_bucket_req_res_bucket' to simplify code.

---
 net/ipv4/nexthop.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
net/ipv4/nexthop.c +1 -5
index 853a75a8fbaf..1556961cf153 100644
@@ -3489,12 +3489,8 @@ static int nh_valid_get_bucket_req(const struct nlmsghdr *nlh,
 		return -EINVAL;
 	}
 
-	err = nh_valid_get_bucket_req_res_bucket(tb[NHA_RES_BUCKET],
+	return nh_valid_get_bucket_req_res_bucket(tb[NHA_RES_BUCKET],
 						 bucket_index, extack);
-	if (err)
-		return err;
-
-	return 0;
 }
 
 /* rtnl */

--
2.25.1

#2 lore raw
In reply to [email protected]

Le 17/09/2022 à 08:30, [email protected] a écrit :

Quoted 14 lines

From: William Dean <[email protected]>

It could directly return 'nh_valid_get_bucket_req_res_bucket' to simplify code.

---
  net/ipv4/nexthop.c | 6 +-----
  1 file changed, 1 insertion(+), 5 deletions(-)
net/ipv4/nexthop.c +0 -0
index 853a75a8fbaf..1556961cf153 100644

net/ipv4/nexthop.c static int nh_valid_get_bucket_req(const struct nlmsghdr *nlh, · line 3493

Quoted 6 lines
net/ipv4/nexthop.c +1 -1
@@ -3489,12 +3489,8 @@ static int nh_valid_get_bucket_req(const struct nlmsghdr *nlh,
  		return -EINVAL;
  	}
 
-	err = nh_valid_get_bucket_req_res_bucket(tb[NHA_RES_BUCKET],
+	return nh_valid_get_bucket_req_res_bucket(tb[NHA_RES_BUCKET],
  						 bucket_index, extack);

Nit: there should be 1 additional space to keep alignment.

CJ

Quoted 7 lines
net/ipv4/nexthop.c +0 -4
-	if (err)
-		return err;
-
-	return 0;
  }
 
  /* rtnl */