diff mbox

[ovs-dev,3/3] dpif-netlink-rtnl: Use OVS_NOT_REACHED in verify.

Message ID 20170519202736.5685-4-joe@ovn.org
State Accepted
Headers show

Commit Message

Joe Stringer May 19, 2017, 8:27 p.m. UTC
The vport_type_to_kind() call at the top of dpif_netlink_rtnl_verify()
ensures that these cases can never be hit, so use OVS_NOT_REACHED()
instead of setting the err to EOPNOTSUPP.

Signed-off-by: Joe Stringer <joe@ovn.org>
---
 lib/dpif-netlink-rtnl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Gregory Rose May 19, 2017, 10:50 p.m. UTC | #1
On Fri, 2017-05-19 at 13:27 -0700, Joe Stringer wrote:
> The vport_type_to_kind() call at the top of dpif_netlink_rtnl_verify()
> ensures that these cases can never be hit, so use OVS_NOT_REACHED()
> instead of setting the err to EOPNOTSUPP.
> 
> Signed-off-by: Joe Stringer <joe@ovn.org>

Acked-by: Greg Rose <gvrose8192@gmail.com>

> ---
>  lib/dpif-netlink-rtnl.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/dpif-netlink-rtnl.c b/lib/dpif-netlink-rtnl.c
> index 76ab0fe3fdec..c57923756f42 100644
> --- a/lib/dpif-netlink-rtnl.c
> +++ b/lib/dpif-netlink-rtnl.c
> @@ -256,7 +256,7 @@ dpif_netlink_rtnl_verify(const struct netdev_tunnel_config *tnl_cfg,
>      case OVS_VPORT_TYPE_UNSPEC:
>      case __OVS_VPORT_TYPE_MAX:
>      default:
> -        err = EOPNOTSUPP;
> +        OVS_NOT_REACHED();
>      }
>  
>      ofpbuf_delete(reply);
Eric Garver May 22, 2017, 5:42 p.m. UTC | #2
On Fri, May 19, 2017 at 01:27:36PM -0700, Joe Stringer wrote:
> The vport_type_to_kind() call at the top of dpif_netlink_rtnl_verify()
> ensures that these cases can never be hit, so use OVS_NOT_REACHED()
> instead of setting the err to EOPNOTSUPP.
> 
> Signed-off-by: Joe Stringer <joe@ovn.org>
> ---
>  lib/dpif-netlink-rtnl.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/dpif-netlink-rtnl.c b/lib/dpif-netlink-rtnl.c
> index 76ab0fe3fdec..c57923756f42 100644
> --- a/lib/dpif-netlink-rtnl.c
> +++ b/lib/dpif-netlink-rtnl.c
> @@ -256,7 +256,7 @@ dpif_netlink_rtnl_verify(const struct netdev_tunnel_config *tnl_cfg,
>      case OVS_VPORT_TYPE_UNSPEC:
>      case __OVS_VPORT_TYPE_MAX:
>      default:
> -        err = EOPNOTSUPP;
> +        OVS_NOT_REACHED();
>      }
>  
>      ofpbuf_delete(reply);
> -- 
> 2.11.1
> 

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

Thanks for the clean ups, Joe.
Eric.
Joe Stringer May 23, 2017, 10:45 p.m. UTC | #3
On 22 May 2017 at 10:42, Eric Garver <e@erig.me> wrote:
> On Fri, May 19, 2017 at 01:27:36PM -0700, Joe Stringer wrote:
>> The vport_type_to_kind() call at the top of dpif_netlink_rtnl_verify()
>> ensures that these cases can never be hit, so use OVS_NOT_REACHED()
>> instead of setting the err to EOPNOTSUPP.
>>
>> Signed-off-by: Joe Stringer <joe@ovn.org>
>> ---
>>  lib/dpif-netlink-rtnl.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/lib/dpif-netlink-rtnl.c b/lib/dpif-netlink-rtnl.c
>> index 76ab0fe3fdec..c57923756f42 100644
>> --- a/lib/dpif-netlink-rtnl.c
>> +++ b/lib/dpif-netlink-rtnl.c
>> @@ -256,7 +256,7 @@ dpif_netlink_rtnl_verify(const struct netdev_tunnel_config *tnl_cfg,
>>      case OVS_VPORT_TYPE_UNSPEC:
>>      case __OVS_VPORT_TYPE_MAX:
>>      default:
>> -        err = EOPNOTSUPP;
>> +        OVS_NOT_REACHED();
>>      }
>>
>>      ofpbuf_delete(reply);
>> --
>> 2.11.1
>>
>
> Acked-by: Eric Garver <e@erig.me>
>
> Thanks for the clean ups, Joe.
> Eric.

Thanks, applied to master.
diff mbox

Patch

diff --git a/lib/dpif-netlink-rtnl.c b/lib/dpif-netlink-rtnl.c
index 76ab0fe3fdec..c57923756f42 100644
--- a/lib/dpif-netlink-rtnl.c
+++ b/lib/dpif-netlink-rtnl.c
@@ -256,7 +256,7 @@  dpif_netlink_rtnl_verify(const struct netdev_tunnel_config *tnl_cfg,
     case OVS_VPORT_TYPE_UNSPEC:
     case __OVS_VPORT_TYPE_MAX:
     default:
-        err = EOPNOTSUPP;
+        OVS_NOT_REACHED();
     }
 
     ofpbuf_delete(reply);