David Ahern <d...@cumulusnetworks.com> writes:

> e_nobufs has 1 user. Move setting err to -ENOBUFS for the 1 user and
> use the goto out label instead of e_nobufs. Stepping stone patch; next
> one moves rth code into a helper function.

Ick you are pessimizing the code.

You will almost certainly have better code generation if you hoist
the assignment of "err = -ENOBUFS" above the rt_dst_alloc then you
don't need to do anything in your error path except "goto out;"

Eric

> Signed-off-by: David Ahern <d...@cumulusnetworks.com>
> ---
>  net/ipv4/route.c | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/net/ipv4/route.c b/net/ipv4/route.c
> index 3c5000db5972..e3b18cc1952f 100644
> --- a/net/ipv4/route.c
> +++ b/net/ipv4/route.c
> @@ -1805,8 +1805,10 @@ out:   return err;
>  
>       rth = rt_dst_alloc(net->loopback_dev, flags | RTCF_LOCAL, res.type,
>                          IN_DEV_CONF_GET(in_dev, NOPOLICY), false, do_cache);
> -     if (!rth)
> -             goto e_nobufs;
> +     if (!rth) {
> +             err = -ENOBUFS;
> +             goto out;
> +     }
>  
>       rth->dst.output= ip_rt_bug;
>  #ifdef CONFIG_IP_ROUTE_CLASSID
> @@ -1852,10 +1854,6 @@ out:   return err;
>  #endif
>       goto out;
>  
> -e_nobufs:
> -     err = -ENOBUFS;
> -     goto out;
> -
>  martian_source:
>       ip_handle_martian_source(dev, in_dev, skb, daddr, saddr);
>       goto out;
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to