2022-09-17 06:40:12

by williamsukatube

[permalink] [raw]
Subject: [PATCH -next] 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.

Signed-off-by: William Dean <[email protected]>
---
net/ipv4/nexthop.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/net/ipv4/nexthop.c b/net/ipv4/nexthop.c
index 853a75a8fbaf..1556961cf153 100644
--- a/net/ipv4/nexthop.c
+++ b/net/ipv4/nexthop.c
@@ -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


2022-09-17 15:32:22

by David Ahern

[permalink] [raw]
Subject: Re: [PATCH -next] nexthop: simplify code in nh_valid_get_bucket_req

On 9/17/22 12:30 AM, [email protected] wrote:
> From: William Dean <[email protected]>
>
> It could directly return 'nh_valid_get_bucket_req_res_bucket' to simplify code.
>
> Signed-off-by: William Dean <[email protected]>
> ---
> net/ipv4/nexthop.c | 6 +-----
> 1 file changed, 1 insertion(+), 5 deletions(-)
>

Reviewed-by: David Ahern <[email protected]>


2022-09-17 16:14:50

by Christophe JAILLET

[permalink] [raw]
Subject: Re: [PATCH -next] nexthop: simplify code in nh_valid_get_bucket_req

Le 17/09/2022 à 08:30, [email protected] a écrit :
> From: William Dean <[email protected]>
>
> It could directly return 'nh_valid_get_bucket_req_res_bucket' to simplify code.
>
> Signed-off-by: William Dean <[email protected]>
> ---
> net/ipv4/nexthop.c | 6 +-----
> 1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/net/ipv4/nexthop.c b/net/ipv4/nexthop.c
> index 853a75a8fbaf..1556961cf153 100644
> --- a/net/ipv4/nexthop.c
> +++ b/net/ipv4/nexthop.c
> @@ -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

> - if (err)
> - return err;
> -
> - return 0;
> }
>
> /* rtnl */