[ovs-dev] [PATCH 1/3] dpif-netlink-rtnl: Tidy up some code.

Eric Garver e at erig.me
Mon May 22 17:36:24 UTC 2017


On Fri, May 19, 2017 at 01:27:34PM -0700, Joe Stringer wrote:
> Simplify and refactor a couple of bits of code for improved readability.
> 
> Signed-off-by: Joe Stringer <joe at ovn.org>
> ---
>  lib/dpif-netlink-rtnl.c | 20 ++++++++++----------
>  1 file changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/lib/dpif-netlink-rtnl.c b/lib/dpif-netlink-rtnl.c
> index 7faad5248037..0ca6529e9d82 100644
> --- a/lib/dpif-netlink-rtnl.c
> +++ b/lib/dpif-netlink-rtnl.c
> @@ -1,5 +1,6 @@
>  /*
>   * Copyright (c) 2017 Red Hat, Inc.
> + * Copyright (c) 2017 Nicira, Inc.
>   *
>   * Licensed under the Apache License, Version 2.0 (the "License");
>   * you may not use this file except in compliance with the License.
> @@ -369,17 +370,16 @@ dpif_netlink_rtnl_port_create(struct netdev *netdev)
>          err = dpif_netlink_rtnl_verify(tnl_cfg, type, name);
>          if (!err) {
>              return 0;
> -        } else {
> -            err = dpif_netlink_rtnl_destroy(name);
> -            if (err) {
> -                static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5);
> -
> -                VLOG_WARN_RL(&rl, "RTNL device %s exists and cannot be "
> -                             "deleted: %s", name, ovs_strerror(err));
> -                return err;
> -            }
> -            err = dpif_netlink_rtnl_create(tnl_cfg, name, type, kind, flags);
>          }
> +        err = dpif_netlink_rtnl_destroy(name);
> +        if (err) {
> +            static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5);
> +
> +            VLOG_WARN_RL(&rl, "RTNL device %s exists and cannot be "
> +                         "deleted: %s", name, ovs_strerror(err));
> +            return err;
> +        }
> +        err = dpif_netlink_rtnl_create(tnl_cfg, name, type, kind, flags);
>      }
>      if (err) {
>          return err;
> -- 
> 2.11.1
> 

Acked-by: Eric Garver <e at erig.me>


More information about the dev mailing list