> This makes it easier to reason about the outputs, and fixes warnings for
> GCC 6.3.x.
> 
> Cc: Venkata Anil <vkomm...@redhat.com>
> Fixes: 31114af758c7 ("ovn-nbctl: Update logical router port commands.")
> Fixes: 80f408f4cffb ("ovn: Use Logical_Switch_Port in NB.")
> Fixes: 36f232bca2db ("ovn: l3ha, CLI for logical router port gateway
> chassis")
> Signed-off-by: Ben Pfaff <b...@ovn.org>

Acked-by: Ian Stokes <ian.sto...@intel.com>

> ---
>  ovn/utilities/ovn-nbctl.c | 23 ++++++++++-------------
>  1 file changed, 10 insertions(+), 13 deletions(-)
> 
> diff --git a/ovn/utilities/ovn-nbctl.c b/ovn/utilities/ovn-nbctl.c index
> a98eacf170de..47df19b231b4 100644
> --- a/ovn/utilities/ovn-nbctl.c
> +++ b/ovn/utilities/ovn-nbctl.c
> @@ -504,6 +504,7 @@ lr_by_name_or_uuid(struct ctl_context *ctx, const char
> *id,
>      bool is_uuid = false;
>      struct uuid lr_uuid;
> 
> +    *lr_p = NULL;
>      if (uuid_from_string(&lr_uuid, id)) {
>          is_uuid = true;
>          lr = nbrec_logical_router_get_for_uuid(ctx->idl, &lr_uuid); @@ -
> 529,9 +530,7 @@ lr_by_name_or_uuid(struct ctl_context *ctx, const char
> *id,
>                           id, is_uuid ? "UUID" : "name");
>      }
> 
> -    if (lr_p) {
> -        *lr_p = lr;
> -    }
> +    *lr_p = lr;
>      return NULL;
>  }
> 
> @@ -540,6 +539,7 @@ ls_by_name_or_uuid(struct ctl_context *ctx, const char
> *id, bool must_exist,
>                     const struct nbrec_logical_switch **ls_p)  {
>      const struct nbrec_logical_switch *ls = NULL;
> +    *ls_p = NULL;
> 
>      struct uuid ls_uuid;
>      bool is_uuid = uuid_from_string(&ls_uuid, id); @@ -567,9 +567,7 @@
> ls_by_name_or_uuid(struct ctl_context *ctx, const char *id, bool
> must_exist,
>                           id, is_uuid ? "UUID" : "name");
>      }
> 
> -    if (ls_p) {
> -        *ls_p = ls;
> -    }
> +    *ls_p = ls;
>      return NULL;
>  }
> 
> @@ -925,6 +923,7 @@ lsp_by_name_or_uuid(struct ctl_context *ctx, const
> char *id,
>                      const struct nbrec_logical_switch_port **lsp_p)  {
>      const struct nbrec_logical_switch_port *lsp = NULL;
> +    *lsp_p = NULL;
> 
>      struct uuid lsp_uuid;
>      bool is_uuid = uuid_from_string(&lsp_uuid, id); @@ -945,9 +944,7 @@
> lsp_by_name_or_uuid(struct ctl_context *ctx, const char *id,
>                           id, is_uuid ? "UUID" : "name");
>      }
> 
> -    if (lsp_p) {
> -        *lsp_p = lsp;
> -    }
> +    *lsp_p = lsp;
>      return NULL;
>  }
> 
> @@ -3043,7 +3040,8 @@ nbctl_lr_nat_add(struct ctl_context *ctx)
>          }
> 
>          logical_port = ctx->argv[5];
> -        error = lsp_by_name_or_uuid(ctx, logical_port, true, NULL);
> +        const struct nbrec_logical_switch_port *lsp;
> +        error = lsp_by_name_or_uuid(ctx, logical_port, true, &lsp);
>          if (error) {
>              ctx->error = error;
>              free(new_logical_ip);
> @@ -3229,6 +3227,7 @@ lrp_by_name_or_uuid(struct ctl_context *ctx, const
> char *id, bool must_exist,
>                      const struct nbrec_logical_router_port **lrp_p)  {
>      const struct nbrec_logical_router_port *lrp = NULL;
> +    *lrp_p = NULL;
> 
>      struct uuid lrp_uuid;
>      bool is_uuid = uuid_from_string(&lrp_uuid, id); @@ -3249,9 +3248,7 @@
> lrp_by_name_or_uuid(struct ctl_context *ctx, const char *id, bool
> must_exist,
>                           id, is_uuid ? "UUID" : "name");
>      }
> 
> -    if (lrp_p) {
> -        *lrp_p = lrp;
> -    }
> +    *lrp_p = lrp;
>      return NULL;
>  }
> 
> --
> 2.16.1
> 
> _______________________________________________
> dev mailing list
> d...@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to